4.17.11
3.10.1
2.4.2
1.3.1

_.lastIndexOf(array, value, [fromIndex=array.length-1])

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

Since

0.1.0

Arguments

argument
array
value
[fromIndex=array.length-1]
type
Array
*
number
description
The array to inspect.
The value to search for.
The index to search from.

Returns

(array)

Example

_.lastIndexOf([1, 2, 1, 2], 2);
// => 3

// Search from the `fromIndex`.
_.lastIndexOf([1, 2, 1, 2], 2, 2);
// => 1
_.lastIndexOf([1, 2, 1, 2], 2);
// => 3

// Search from the `fromIndex`.
_.lastIndexOf([1, 2, 1, 2], 2, 2);
// => 1