JavaScript chapters

Chapter 2 of 17

Setting up JavaScript

Try this in our JavaScript Compiler →

Tools you need

To write and run JavaScript you need three things: a place to write code (any text editor such as VS Code works), a way to run the code (an interpreter or compiler for JavaScript), and a terminal where you can type commands. Most modern editors bundle a terminal so you only need to install one program.

Your first file

Create a file named hello.js and paste in the snippet below. Save the file, then run it from your terminal. If you see the words "Hello, World!" printed back, your installation is correct and you are ready to learn the rest of the language.

console.log("Hello, World!");

Common installation issues

If the command is not recognised, the language is not on your system PATH. Reinstall and tick "add to PATH" if the option is offered. On a school or work machine where you cannot install software, use any online playground — the code in this course runs unchanged in a browser-based editor.

Practice and verify

Change one meaningful value in the example and predict the result before running. Then test a boundary or empty value. Explain what changed and why, rather than only copying the output.

Try it yourself

Output
Run your project to see output here.
Ctrl/Cmd+Enter runs · Ctrl/Cmd+S downloads the project · Local auto-save is always on