reduce的原生写法
reduce
特点: reduce() 方法接收一个函数作为累加器,数组中的每个值(从左到右)开始缩减,最终计算为一个值。
源码实现
| 1 | Array.prototype.myReduceRight = function(func, init) { | 
特点: reduce() 方法接收一个函数作为累加器,数组中的每个值(从左到右)开始缩减,最终计算为一个值。
源码实现
| 1 | Array.prototype.myReduceRight = function(func, init) { |