x
 
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript String 方法</h2>
<p>lastIndexOf() 方法返回指定文本最后一次出现的位置:</p>
<p id="demo"></p>
<script>
let str = "Please locate where 'locate' occurs!";
document.getElementById("demo").innerHTML = str.lastIndexOf("locate");
</script>
</body>
</html>