findLast source npm

_.findLast(collection, [predicate=_.identity])

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

Arguments

  1. collection (Array|Object)

    The collection to search.

  2. [predicate=_.identity] (Function|Object|string)

    The function invoked per iteration.

Returns (*)

Returns the matched element, else undefined.

Example

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