Primitive and Reference Values
- Primitives. A primitive: number, string, boolean, null, undefined, symbol, bigint: is copied by value and never changes in place.
- Reference values. Objects and arrays are reference values: variables hold a pointer to them, not the data itself.
- typeof. The typeof operator names a value’s type as a string: with the famous quirk that typeof null says object.
Coercion, Equality and Truthiness
- Coercion. Coercion is JavaScript converting a value’s type for you: the reason "5" + 1 is "51" but "5" - 1 is 4.
- Strict equality. Triple-equals compares without converting; double-equals coerces first, so professionals default to strict equality.
- Truthiness. Every value acts true or false in a condition; the six falsy values are false, 0, "", null, undefined and NaN.
Understanding null, undefined and Special Values
- undefined. A variable that was declared but never assigned holds undefined: the language’s own mark for “no value yet”.
- null. null is the value you assign on purpose to say “intentionally empty”: a signal from the programmer, not the engine.
- NaN. NaN means not-a-number, appears when arithmetic goes wrong, and is famously not equal even to itself.
Before and after this level
- Before: Level 4: Arrays & Objects: Arrays and Collection Operations, Objects, Properties and Destructuring, Working With Nested Data.
- Next: Level 6: Objects & Prototypes: Prototypes and Prototype Chains, Classes and Object-Oriented JavaScript, Composition and Encapsulation.
In the app each of these ideas is taught and then asked back, and the level ends with a checkpoint and flashcards. See Checkpoints and flashcards.
Frequently asked questions
What does JavaScript Level 5: JavaScript's Type System cover?
Primitive and Reference Values, Coercion, Equality and Truthiness, Understanding null, undefined and Special Values: 3 lessons and 9 ideas.
What should I know before this level?
The level before it, Level 4: Arrays & Objects, which covers Arrays and Collection Operations, Objects, Properties and Destructuring, Working With Nested Data.