Returns the index of the last occurrence of a specified value in a typed array, or -1 if it is not present.
lastIndexOf(value, fromIndex?)
value
The value to locate in the array.
fromIndex optional
The array index at which to begin searching backward. If fromIndex is omitted, the search starts at the last index in the array.
An index or -1 if the element was not found.
new Uint8Array([1, 2, 42, 42, 108]).lastIndexOf(42)
3
// compare to indexOf:
new Uint8Array([1, 2, 42, 42, 108]).indexOf(42)
2