The code above will produce this output on an HTML page:
To insert a script in an HTML page, we use the <script> tag. Use the type attribute to define the scripting language
Then the <script> tag has to be closed
Ending Statements With a Semicolon?
With traditional programming languages, like C++ and Java, each code statement has to end with a semicolon.
How to Handle Older Browsers
Browsers that do not support scripts will display the script as page content. To prevent them from doing this, we may use the HTML comment tag:
Note: You cannot put // in front of the first comment line (like //<!–), because older browsers will display it. Strange? Yes! But that’s the way it is.