Array.protopy.myReduce = function(fn,value){
if(typeof fn !== 'function'){
console.log('第一个参数必须为一个函数')
return
}
const acc = value || this[0];
const startIndex = value ? 0 : 1
for(let i = startIndex; this.length,i++){
acc = fn(acc,this[i],i,this)
}
return acc
}