146. implement Array.prototype.reduce()

JavaScript Apple Amazon

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

Always try to find a better approach.