146. implement Array.prototype.reduce()

medium  - accepted / - tried

Array.prototype.reduce() is a handy method to process arrays.

Here is a simple task - Could you implement it by yourself?

[1,2,3].myReduce((sum, item) => sum + item)
// 6
  1. do not use native Array.prototype.reduce() in your code
  2. your function is only tested against valid array (no array-like objects)
  3. thanks to pajadev for suggesting this

Think aloud!

(3)
(111)