JavaScript Array findLast() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Array

Definition

Array.prototype.findLast(callback) returns the last element that passes your test. It searches from the end toward the start. No match → undefined. Does not mutate the array (ES2023).

Remember
array.findLast((element, index, array) => test)

scans from the end → first hit from the tail
no match → undefined
find()      → first match from the start
findLastIndex() → index of last match (−1 if none)

Syntax

Call array.findLast. Start with this line.

JavaScript
array.findLast(callback, thisArg?)
CallWhat it does
array.findLast(callback, thisArg?)Primary signature.
array.findLast(...)Call with the arguments your case needs.

Built into JavaScript. Call findLast(...) on an array instance — no import required.

Library declarations
JavaScript
array.findLast(callback, thisArg?)

Parameters

ParameterDescription
callbackRequired. Test function; truthy → return that element
index, arrayOptional. Extra callback args when needed

Return Value

Return ValueDescription
*Last match, or undefined

JavaScript Examples

Example 1 — Last Matching Number

Return the last value greater than 30—scanning from the end.

JavaScript
const numbers = [10, 20, 30, 40, 50];
const result = numbers.findLast((n) => n > 30);

console.log(result);  // 50
Try It Yourself

How It Works

  1. Start at the end. Index 4 is checked first.
  2. Test 50. 50 > 30 is true.
  3. Return immediately. Result is 50—no need to look at 40.
  4. Direction matters. From the start, the first > 30 would be 40.

Example 2 — find() vs findLast()

Same predicate, two directions—two different high scores.

JavaScript
const scores = [85, 90, 75, 90, 60];

const firstHigh = scores.find((s) => s >= 90);
const lastHigh = scores.findLast((s) => s >= 90);

console.log("find:", firstHigh);      // 90 (index 1)
console.log("findLast:", lastHigh);   // 90 (index 3)
Try It Yourself

How It Works

  1. Two matches. Scores at indexes 1 and 3 are both 90.
  2. find from the start. Hits index 1 first.
  3. findLast from the end. Hits index 3 first (in reverse).
  4. Same value here. Values match, but they are different array slots—use indexes when you need to know which one.

Example 3 — Last Matching Object

Find the most recent active user when the list is ordered oldest → newest.

JavaScript
const users = [
  { name: "Alice", status: "active" },

  { name: "Bob", status: "inactive" },

  { name: "Charlie", status: "active" }
];

const lastActive = users.findLast((u) => u.status === "active");

console.log(lastActive);
Try It Yourself

How It Works

  1. Ordered list. Assume later entries are newer.
  2. Scan from the end. Charlie is checked before Bob and Alice.
  3. Active match. Charlie’s status passes → return that object.
  4. Alice skipped. She is also active, but not the last match.

Browser & Runtime Support

Array.prototype.findLast() is part of ES2023. Evergreen browsers shipped it in 2022; Node.js added it in version 18.

✓ Baseline · ES2023

Array.prototype.findLast()

Supported in Chrome 97+, Firefox 104+, Safari 15.4+, Edge 97+, and Node 18+. Not available in Internet Explorer or older Node releases.

92% Modern browser support
Google Chrome Supported · Desktop & Mobile
Full support
Mozilla Firefox Supported · Desktop & Mobile
Full support
Apple Safari Supported · macOS & iOS
Full support
Microsoft Edge Supported · Chromium
Full support
Internet Explorer No native support · Use a polyfill
Polyfill
Opera Supported · Modern versions
Full support
Samsung Internet Supported · Android
Full support
Bun Supported · JavaScript runtime
Supported
Deno Supported · JavaScript runtime
Supported
Node.js Supported · Server runtime
Supported
Android WebView Supported · Modern WebView
Full support
Array.findLast() Strong

Bottom line: Safe for current evergreen browsers and Node 18+. For older targets, polyfill or loop from length - 1 downward.

Frequently Asked Questions

findLast() returns the last element in an array for which the callback returns a truthy value. It searches from the end toward the start. If no element matches, it returns undefined.
No. findLast() only reads elements through your callback. The original array is unchanged.
find() returns the first match scanning from index 0. findLast() returns the last match scanning from the end. On arrays with duplicate matches, they often return different elements.
It returns undefined, the same as find(). Check for undefined before using the result.
findLast() returns the matching element. findLastIndex() returns its index (or -1). They share the same tail-first search direction.
findLast() is an ES2023 feature. It works in Chrome 97+, Firefox 104+, Safari 15.4+, Edge 97+, and Node 18+. Older environments need a polyfill or a manual reverse loop.

Next: findLastIndex()

Get the position of the last match—or -1 when nothing passes.

findLastIndex() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

11 people found this page helpful