146. implement Array.prototype.reduce()

Is this helpful ?

from all members: - 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

Let's try to solve this problem within 5 mintues.