lastIndexOf() method returns the last index at which a given element can be found in the array. Semantically the same as ↴
lastIndexOf() method returns the index of the first element from the end of array that passes test from provided function.
syntax ↴
lastIndexOf(element, start) ↴
element The element to locate in the array.
start (optional). Where to start the search from.
The first element element position is 0, the second is 1, ...
Negative start values counts from the last element (but still searches from right to left).
lastIndexOf() method starts from end of array and searches from right to left.
lastIndexOf() method returns the last index at which a given element can be found in the array.
lastIndexOf() method returns -1 if the value is not found.
lastIndexOf() method does not change the original array.
lastIndexOf() method is case-sensitive.
myArray.lastIndexOf(element)
myArray.lastIndexOf(element, start)