← Back to release summary

Array and TypedArray findLast and findLastIndex

Category
JavaScript
Type
Chromium catches up
Status
In developer trial (Behind a flag) (Chrome 97)
Intent stage
Dev trials

Summary

This is a Stage 3 TC39 proposal that adds the methods findLast and findLastIndex to Array.prototype and the various TypedArray.prototypes. These methods are the "from the end" versions of find and findIndex.

Motivation

Finding an element in an Array is a common operation. However, finding an element from the end of an Array is unergonomic. The current ergonomic solutions like `array.reverse().find` require unnecessary mutation or copying. This proposal adds "from the end" versions of the common `find` and `findIndex` methods: `findLast` and `findLastIndex`.

Standards & signals

Explainers: https://github.com/tc39/proposal-array-find-from-last

View on chromestatus.com