代码示例:(标识:eg_js_string_lastindexof)
<!DOCTYPE html>
<html>
<body>

<h1>JavaScript 字符串方法</h1>

<p>lastIndexOf() 返回指定文本最后出现的位置:</p>

<p id="demo"></p>

<script>
var str = "The full name of China is the People's Republic of China.";
var pos = str.lastIndexOf("China");
document.getElementById("demo").innerHTML = pos;
</script>

</body>
</html>
运行结果: