文字列内で最後に出現するインデックスを返します。
構文
str.lastIndexOf(searchStr, fromIndex?)使用例
下記の値を入力するとサンプルに即時反映されます。
const→console→lastIndexOf→const text = "hello world hello";
console.log(text.lastIndexOf("hello")); // 12
console.log(text.lastIndexOf("world")); // 6