GT2/GT2-Android/node_modules/array-reduce/example/sum.js

5 lines
135 B
JavaScript
Raw Normal View History

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