Returns the index of the last occurrence of a specified value.
Syntax
str.lastIndexOf(searchStr, fromIndex?)Example
Enter values below to update the example in real time.
const→console→lastIndexOf→const text = "hello world hello";
console.log(text.lastIndexOf("hello")); // 12
console.log(text.lastIndexOf("world")); // 6