var sum = function(arr) { return arr.reduce(function(a, b) { return a + b; }); }; console.log(sum([1, 2, 3, 4, 5])); //-> 15
牌語備忘録 -pygo
var sum = function(arr) { return arr.reduce(function(a, b) { return a + b; }); }; console.log(sum([1, 2, 3, 4, 5])); //-> 15