1. Array.prototype.myReduce = function (cb, initialValue) { let pre = initialValue ? initialValue : 0; const _reduce = () => { for (let i = 0; i < this.length; i++) { pre = cb(pre, this[i]); } }; _reduce(); return pre; };