Knowledgize

.lastIndexOf(value, fromIndex)

Returns the last index at which a given element can be found in the array, or -1 if it is not present. Optionally, starts the search from the end or a specific index.

Examples:

let numbers = [1, 2, 3, 2, 1]; let lastIndex = numbers.lastIndexOf(2); console.log(lastIndex); // 3
let lastIndexFrom = numbers.lastIndexOf(2, 2); console.log(lastIndexFrom); // 1