I am proposing a replacement for Array.prototype.reduce and Array.prototype.reduceRight. The main improvements are 1) iteration always starts at index 0 (or k-1 in the case of accumulateRight) on non-empty arrays and 2) it allows definition of callbackFn's ‘this' context just like ‘every’, ‘filter’, ‘find’, ‘findIndex’, ‘forEach’, ‘map', and ‘some’.
The code is simple, but I have included much explanation because of the blank stares I get from people when I say “the problem with Array reduce” so I anticipate resistance. Please visit the GitHub repo. and review on here. https://github.com/MarkMYoung/ArrayAccumulate <https://github.com/MarkMYoung/ArrayAccumulate>
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

