Exercise:
Use the length property to display the length of the txt variable's value.
Edit This Code:
See Result »
<!DOCTYPE html> <html> <body> <p id="demo"></p> <script> var txt = "Hello World!"; document.getElementById("demo").innerHTML = txt; </script> </body> </html>
Result:
Show Answer
Correct Code:
<!DOCTYPE html> <html> <body> <p id="demo"></p> <script> var txt = "Hello World!"; document.getElementById("demo").innerHTML = txt.length; </script> </body> </html>
Correct Result:
Hide Answer
Privacy Policy