<html>
<body>
<h1>JavaScript 字符串</h1>
<h2>endsWith() 方法</h2>
<p>如果字符串以规定字符串结尾,endsWith() 方法返回 true。否则返回 false。</p>
<p>检查 "Hello world" 是否以 "world" 结尾:</p>
<p id="demo"></p>
<p>Internet Explorer 11(及更早版本)不支持 endsWith()。</p>
<script>
let text = "Hello world";
let result = text.endsWith("world");
document.getElementById("demo").innerHTML = result;
</script>
</body>
</html>