_.findLast(collection, [predicate=_.identity], [fromIndex=collection.length-1])
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
_.findLast([1, 2, 3, 4], function(n) { return n % 2 == 1; }); // => 3
Please login to continue.