reduce() polyfills
//Polyfills for reduce()
Array.prototype.myReduce = function (cb,initValue){
var accumulator = initValue
for(let i = 0;i<this.length;i++){
accumulator = accumulator ? cb(accumulator,this[i],i,this) : this[i]
}
return accumulator
}
const arr = [3,5,6,1,77,634,3]
const reducedArr = arr.myReduce((acc,cur)=> acc+cur,0)
console.log(reducedArr)