Favorites

JavaScript Array.prototype.findLastIndex() Method

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
Array.prototype.findLastIndex()
JavaScript Array Instance methodThis method is supported by all modern browsers.
Updated 28th November 2026

The findLastIndex() method returns the index of the last element in an array that passes a test, or -1.

Description

The findLastIndex() method searches the array from the end and returns the index of the last element for which the callback returns a truthy value. If there is no match it returns -1. It's the backwards counterpart of findIndex().

The index it returns is the position counted from the start of the array, not from the end, so it can be used directly with bracket access, splice() or with(). Like findIndex(), it calls the callback for empty slots as well as filled ones, passing undefined for them.

A typical use is finding the most recent entry in a history list that meets a condition, or the last valid item before an error, without reversing the array. When you're searching for an exact value rather than testing a condition, lastIndexOf() does the same job.

Syntax

array.findLastIndex(callbackFn)
array.findLastIndex(callbackFn, thisArg)

Parameters

  • callbackFnA function called for each element, receiving element, index and array.
  • thisArgOptional. A value to use as this inside callbackFn.

Return Value

The index of the last element that passes the test, or -1 if none does.

Example

const temps = [18, 25, 31, 22, 33, 19];
console.log(temps.findLastIndex(t => t > 30));
console.log(temps.findLastIndex(t => t > 40));

Browser Support

The following information will show you the current browser support for the Array.prototype.findLastIndex() method. Hover over a browser icon to see the version that first introduced support for this method.

This method is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee