Javascript: First Steps

📄 Wiki page | 🕑 Last updated: Feb 9, 2022

You can use this guide as a quick and simple way to learn Javascript, or as a quick JS reference guide.

At least some prior programming knowledge is required. Due to its clumsy design, I wouldn't recommend learning JS as your first language anyway (it will be later hard to get rid of some bad assumptions you'll build in the process).

OK, let's start with some basic syntax. If you've ever used any C-like language, JS syntax will look very similar.

Hello world

Javascript supports both single and multi-line comments:

   This is an example of a
   multi-line comment 
// This is an example of a single-line comment

console.log('Hello world');

Semicolons at the end of statements are mostly optional, but, at least for now, I recommend using them anyway, to avoid problems like this:

// this is fine

// this is not: TypeError: console.log(...) is not a function
(() => { console.log("b") })()

Javascript is not white-space sensitive, and blocks are delimited with { ... } brackets.

OK, let's get more practical. The best way to learn JS is to experiment with the REPL. The nice thing about JS is that you already have it in your browser, so you can just press F12 to get a very nice REPL, where you can copy&paste any of these examples.

The alternative is to install node.js (see and then you can use:

node script.js
node //open REPL

Let's explore which data types we have available.

Data Types >

Ask me anything / Suggestions

If you have any suggestions or questions (related to this or any other topic), feel free to contact me. ℹī¸

If you find this site useful in any way, please consider supporting it.