Returns the last index at which a given value can be found in an array.
If the value is not found, -1 is returned.
-1
const arr = [1, 2, 3, 4, 2, 5];lastIndexOf(2)(arr); // 4lastIndexOf(6)(arr); // -1lastIndexOf(2, 3)(arr); // 4 Copy
const arr = [1, 2, 3, 4, 2, 5];lastIndexOf(2)(arr); // 4lastIndexOf(6)(arr); // -1lastIndexOf(2, 3)(arr); // 4
Optional
Returns the last index at which a given value can be found in an array.
If the value is not found,
-1
is returned.Example