【文件属性】:
文件名称:balance-points:查找数组的平衡点
文件大小:6KB
文件格式:ZIP
更新时间:2021-04-30 14:20:04
JavaScript
平衡点
查找数组的平衡点。
平衡点是索引的左侧等于索引的右侧的位置。 此函数返回平衡点索引数组。
安装
npm install balance-points
bower install balance-points
用法
const balancepoints = require ( 'balance-points' ) ;
console . log ( balancePoints ( [ 3 , - 2 , 0 , 4 , 6 , - 5 ] ) ) ; // [3]
console . log ( balancePoints ( [ 1 , 0 , 0 , 1 ] ) ) ; // [1, 2]
console . log ( balancePoints ( [ 2 , - 1 , 1 , - 1 , 1 ] ) ) ; // [0]
console . log ( balance
【文件预览】:
balance-points-master
----.jshintrc(500B)
----.gitignore(1KB)
----.jscsrc(118B)
----package.json(971B)
----LICENSE.md(1KB)
----.travis.yml(88B)
----CHANGELOG.md(151B)
----README.md(688B)
----balance-points.js(891B)
----.gitattributes(52B)
----bower.json(478B)
----test()
--------balance-points.js(567B)
----.editorconfig(427B)