<!DOCTYPE html> <html> <body> <p>Click the button to return the number of characters in the string "Hello World!".</p> <button onclick="myFunction()">Try it</button> <p id="demo"></p> <script> function myFunction() { var str = "Hello World!"; var n = str.length; document.getElementById("demo").innerHTML = n; } </script> </body> </html>