Creating your first JavaScript part 2

Output



Let's use JavaScript to print "Hello World" to the browser.
<html>
<head> </head>
<body>
<script>
document.write("Hello World!");
</script>
</body>
</html>
Try It Yourself

The document.write() function writes a stringinto our HTML document. This function can be used to write text, HTML, or both. 

The above code displays the following result:
The document.write() method should be used only for testing. Other output mechanisms appear in the upcoming lessons.
Please type in a code to output the "Hello world!" text on the screen.

<script>
document.
 Write


("Hello world!");
</script>

Comments

Popular posts from this blog

Comparison Operators part 2

Break and Continue part 1

Module 2