Getting Started JS Home  <<  JS Basics  <<  Getting Started

In this lesson we create the ubiquitous 'Hello World' program using JavaScript to get us started on our journey into the wonderful world of JavaScript programming.

This will introduce us to the look of some basic JavaScript code and lead nicely into the following lessons in the basics section.

Following is sample code that will make an alert box appear with the text 'Hello World!' when the 'Run Hello World' button below is pressed.


<script >
  alert('Hello World!');
</script>

Press the button below to action the above code:

Reviewing Our Changes

When you click on the 'Run Hello World' button the sample Javascript code is run and the alert box appears with the code we entered for the alert.

The actual JavaScript to create the alert box in our example was placed within the <head>></head> HTML element, but can also be placed within the <body></body> HTML element.

We will cover placement of code in JavaScript Basics - Lesson 4: Applying JavaScript.

Lesson 1 Complete

In this lesson we created a simplistic JavaScript program, which popped up an alert window, just to get a feel for the language and take an early look at some of the syntax involved.