VOOZH about

URL: https://www.geeksforgeeks.org/javascript/lodash-_-findlast-method/

⇱ Lodash _.findLast() Method - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Lodash _.findLast() Method

Last Updated : 15 Jul, 2025

Lodash _.findLast() method iterates over the elements in a collection from the right to the left. It is almost the same as _.find() method.

Syntax:

_.findLast(collection, predicate, fromIndex);

Parameters:

  • collection: It is the collection that the method iterates over.
  • predicate: It is the function that is invoked for every iteration.
  • fromIndex: It is the index of the array from where the search starts.

Return Value:

This method returns the element that matches, else undefined.

Example 1: In this example, we are getting the last existing element in an array which is satisfying the given condition in a function by the use of the lodash _.findLast() method.

Output:

5

Example 2: In this example, we are getting the last existing element in an array which is satisfying the given condition in a function by the use of the lodash _.findLast() method.

Output:

6
55

Example 3: In this example, we are getting undefined as the last existing element in an array which is satisfying the given condition in a function is not present.

Output:

undefined
Comment