Command Palette

Search for a command to run...

Hectal
Phase 1Beginner2 of 16 in JavaScript

Values, Types and Variables

Variables with let and const, the seven primitive types, how numbers and strings really work, type conversion, and == vs ===.

Every program is about values: numbers, words, yes/no answers, and "nothing". This phase teaches you how to keep values in variables (let and const, and why old var causes bugs), which types of value JavaScript has, and how to ask a value what type it is with typeof.

Then you'll go deep on the two types you'll use most. Numbers: why 0.1 + 0.2 isn't 0.3, what NaN and Infinity are, the largest safe whole number and when you need BigInt. Strings: quotes, escaping, template literals, length, indexing and why strings never change in place.

Finally you'll learn how JavaScript turns one type into another, on purpose and behind your back, and how to compare values safely with ===, Object.is and the truthy/falsy rules. These are the rules behind most beginner bugs and many interview questions. Every example is live: predict the output, press Run, and check.

0/6 · 0%
6 topics ~2 h 24 code blocks & diagrams
Start with the first topic

Practise this phase

Hands-on exercises: write the code, see your page live, and press Check to have it tested automatically.