数组中 reduce累计运算

let arr = [1,2,3,4];

let sum = (a, b) => a + b;

arr.reduce(sum, 0);

最后输出10

posted @ 2018-11-22 14:09  麦君  阅读(346)  评论(0编辑  收藏  举报