AES.Next
Beginning with ECMAScript 2015 (ES6), the TC-39 committee moved to begin releasing a new ECMA specification each year. Doing so allows them to collect all individual proposals that are at a sufficiently advanced stage and package them as a single bundle. This packaging is of limited importance, however, as browser vendors tend to adopt proposals in a piecemeal fashion. When a proposal has reached stage 4, its behavior will not change, it is likely to be included in the next ECMAScript release, and browsers will begin adopting the proposal's features at their discretion.
This appendix will discuss the handful of late-stage ECMAScript proposals that seem likely to be incorporated into the next formal ECMAScript edition.
ARRAY FIND FROM LAST METHODS
This proposal adds .findLast() and .findLastIndex() methods on arrays and typed arrays. These methods are analogous to .find() and .findIndex(), the only distinction being that they return the last match instead of the first. In other words, .find() is equivalent to .reverse().find(), but it obviates the need for the intermediate array reversal. This behavior is demonstrated here:
const hasFoo = (string) => string.includes("foo");const strings = ["hello", "foo", "world", "foobar", "baz"];console.log(strings.find(hasFoo)); ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access