This the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

JavaScript

Despite what proponents of other languages might proclaim, JavaScript is an amazing language. Here you can learn about JavaScript features and practices ranging from introductory to advanced levels.

Some programming knowledge is required

There are many incredible “learn to code” resources out there, and it is not my intention to add to their number. Hence, you should have basic programming knowledge to engage with this site. The introductory sections here can be ignored if you are already familiar with JavaScript to an extent, and these sections are mostly here to help developers coming from other languages.

That being said, there may be gaps in your introductory knowledge as there are gaps in mine! In which case, it may be useful to gloss over the introductory sections. I’ve had it many times where I’ve been reviewing code of a junior developer and I learn something new, that I should have known before.

Prerequisites

1 - Scope

If you’re coming from another language, scope in JavaScript will probably be pretty intuitive… with some exceptions.

Some programming knowledge is required

Let

let foo = 1;

{
    let foo = 2;
}

console.log(foo); // 1
let foo = 1;

{
   foo = 2;
}

console.log(foo); // 2

Const

const foo = 1;

{
    const foo = 2;
}

console.log(foo); // 1
const foo = 1;

{
   foo = 2; // error
}

Var

var foo = 1;

{
    var foo = 2;
}

console.log(foo); // 2
var foo = 1;

{
    foo = 2;
}

console.log(foo); // 2