JavaScript Tutorial – Part 1: Hello JavaScript!

I am now starting to learn JavaScript, and one thing I have learned over the years is that the best way for me to remember things Is to write then down, so if I’m already doing this, why not write a tutorial on the subject? so here it goes. hope this will be the first of many the come. Let’s get started.

One of the nice things about JavaScript (or ECMAScript which is the “correct” name of the language as Javascript is trademarked), is that it really lowers the bar to the minimum for starting programmers. You don’t need to download a compiler or an interpreter, you don’t need any special IDE, Zero, Nada! Just open notepad or any other text editor, write a program and execute it in your browser which already includes a built-in JavaScript interpreter. I think this is one of the reasons that JavaScript is so popular.

I’ll start with the typical “Hello world” example that starts every programming language tutorial. Open up your favorite editor (yes, even notepad) and write the following code (or copy and paste if you are as lazy as I am):

        <title>Hello world</title>
            alert("Hello World");

Save the file as “hello.html” (or any name you want but end it with “html”). Double click on the file and this should open up a browse window showing a dialog with the text “Hello World”. Something like this:

JavaScript Hello World

That was really simple, wasn’t it? But congratulations! you have now written your first JavaScript Program :-).

In the next tutorial I will start doing real stuff that is a bit more useful than this but I wanted to show here how it is very easy to get started. See you next time!

Next Tutorial: Variables, Functions, and Objects

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.