Skip to content

Latest commit

 

History

History
10 lines (9 loc) · 171 Bytes

array.md

File metadata and controls

10 lines (9 loc) · 171 Bytes

reduce

Array.prototype.myReduce = function(f, value = 0) {
  for (let i = 0; i < this.length; i++) {
    value = f(this[i], value);
  }
  return value;
};