esdiscuss/esdiscuss.org

Proposal: Array.prototype.forEachRight

AlastairTaft opened this issue · 3 comments

This is a proposal for the forEachRight method for iterating over an array in reverse. Its pretty useful when you want to remove items from an array while iterating over it.

There exists both reduce() and reduceRight() so why not forEach() and forEachRight()?

I've created a polyfill here.

Please read https://github.com/tc39/proposals/blob/master/CONTRIBUTING.md for how to contribute; this repo is just for the esdiscuss website.

Separately, none of the other array methods have Right variants besides reduce; if we added another we'd want to add it for all of them, for consistency.

esdiscuss is an email list; its suggesting you email the list (there's no facility for non-members to propose anything on github). Perhaps those docs need to be made clearer.

In general, having one exception is acceptable, two is a problem pattern.