您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
rpm-mcarman b9f7ec4306 First Commit 3 年前
..
example First Commit 3 年前
test First Commit 3 年前
.travis.yml First Commit 3 年前
LICENSE First Commit 3 年前
index.js First Commit 3 年前
package.json First Commit 3 年前
readme.markdown First Commit 3 年前

readme.markdown

array-reduce

[].reduce() for old browsers

testling badge

build status

example

var reduce = require('array-reduce');
var xs = [ 1, 2, 3, 4 ];
var sum = reduce(xs, function (acc, x) { return acc + x }, 0);
console.log(sum);

output:

10

methods

var reduce = require('array-reduce')

var res = reduce(xs, f, init)

Create a result res by folding acc = f(acc, xs[i], i) over each element in the array xs at element i. If init is given, the first acc value is init, otherwise xs[0] is used.

install

With npm do:

npm install array-reduce

license

MIT