.findLast(collection, [predicate=.identity], [fromIndex=collection.length-1])

sourcenpm package

This method is like _.find except that it iterates over elements of collection from right to left.

Since

2.0.0

Arguments

  • collection (Array|Object): The collection to inspect.
  • [predicate=.identity] (Function)_: The function invoked per iteration.
  • [fromIndex=collection.length-1] (number): The index to search from.

Returns

(*): Returns the matched element, else undefined.

Example

  1. _.findLast([1, 2, 3, 4], function(n) {
    return n % 2 == 1;
    });
    // => 3