<html>
<body>
<h1>JavaScript Strings</h1>
<h2>The endsWith() Method</h2>
<p>endsWith() returns true if a string ends with a specified string, otherwise false.</p>
<p>Check if "Hello world" ends with "world":</p>
<p id="demo"></p>
<script>
let text = "Hello world";
let result = text.endsWith("world");
document.getElementById("demo").innerHTML = result;
</script>
</body>
<!-- /jsref/tryit.asp?filename=tryjsref_endswith Thu, 06 Feb 2025 18:36:04 GMT -->
</html>