findLastIndex
_.findLastIndex(predicate, array)
# Ⓢ [Ⓣ][1] Ⓝ
This method is like _.findIndex except that it iterates over elements
of collection from right to left.
Since
2.0.0
Arguments
predicate(Function): The function invoked per iteration.array(Array): The array to inspect.
Returns
(number): Returns the index of the found element, else -1.
Example
var users = [
{ 'user': 'barney', 'active': true },
{ 'user': 'fred', 'active': false },
{ 'user': 'pebbles', 'active': false }
];
_.findLastIndex(function(o) { return o.user == 'pebbles'; }, users);
// => 2
// The `_.matches` iteratee shorthand.
_.findLastIndex({ 'user': 'barney', 'active': true }, users);
// => 0
// The `_.matchesProperty` iteratee shorthand.
_.findLastIndex(['active', false], users);
// => 2
// The `_.property` iteratee shorthand.
_.findLastIndex('active', users);
// => 0