The classic first program on any platform is to output the string “Hello World”. Hang on, string? Yes, it’s a string of characters: H-e-l-l-o-space-W-o-r-l-d. Technically, it’s an array but you don’t need to know about that now.
The other thing you need to print Hello World is a print command. This may be PRINT “Hello World” in BASIC, which nobody uses anymore or printf(“Hello World”); in C, which few people use anymore.
But it’s a good teaching example of a very, very simple program. A command and some data that interacts with the human operator (you) probably via a screen. In the old days it would have been printer and paper.
To make a Hello World program, it depends on which platform you’re using. There are roughly two types: Programming platforms and languages where you need to set up an environment, a project, include libraries and do loads of other work just to get to Hello World. The other is scripting environments, where a lot of the stuff in programming environments is already done for you and you can type things in and run them immediately.
I recommend the latter so we can get to Hello World quicker. If you are reading this in a web browser, I don’t know how else you would, hit the F12 key to open the dubugger. There will be a tab called Console which gives you a basic command line. Type:
console.log(“Hello World”);
This should ‘log’ (output) a line to the console, the command prompt you are tying on. You can see that there’s lots of punctuation on this line and that’s all needed to satisfy JavaScript’s syntax. Getting the punctuation and spelling right is the first thing you need to do or you get syntax errors and these are the most common errors you will get. You will get mostly errors when you program and most of programming is fixing errors.
