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!

Table of Contents

 About This Book

Introduction to JavaScript

 What Is JavaScript?

First JavaScript - "Hello World!"

 Walking through the First JavaScript

 The document.write() Method

 ECMAScript Language Specification and JavaScript Dialects

 Data Types, Variables and Expressions

 Flow Control Statements

 Creating, Accessing, and Manipulating Arrays

 Defining and Calling Functions

 Web Browser Supporting JavaScript

 Server-Side and Client-Side Web Scripting

 Introduction to Objects

 Defining Your Own Object Types

 Inheritance of Properties and Methods through the Prototype Object Chain

 'jrunscript' - JavaScript Shell Command from JDK

 Using Functions as "Function" Objects

 Introduction to Built-in Object Types

 W3C's Document Object Model (DOM) Specifications

 References

 PDF Printing Version