Run ❯
Get your
own
website
Result Size:
625 x 565
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <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> </html>