146. implement Array.prototype.reduce()
Share
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
- do not use native Array.prototype.reduce() in your code
- your function is only tested against valid array (no array-like objects)
- thanks to pajadev for suggesting this