JavaScript Tutorials - Herong's Tutorial Examples
Dr. Herong Yang, Version 2.00

First JavaScript - "Hello World!"

This section provides the first JavaScript tutorial example - 'Hello World!'.

To show you how a simple JavaScript looks like, follow this tutorial to create our first JavaScript - "Hello World!".

1. Enter the following HTML document with one line of JavaScript:

<html>
<head><title>Hello World!</title></head>
<body>
<script type="text/javascript">
   document.write('Hello World!');
</script>
</body>
</html>

2. Save this HTML document as Hello_World.html.

3. Open Hello_World.html in Web browser. You will see:

Hello World! 

Congratulations, you have created and executed your first JavaScript successfully!

Sections in This Chapter

What Is JavaScript?

First JavaScript - "Hello World!"

Walking through the First JavaScript

The document.write() Method

Dr. Herong Yang, updated in 2008
First JavaScript - "Hello World!"