typeof, Truthy/Falsy, and == vs ===
Use typeof safely, recognize truthy/falsy, and compare values correctly with ===.
Intro
Goal: Learn how typeof identifies types, which values are truthy or falsy, and when to use === instead of ==.
- typeof basics
- Truthy vs falsy
- Strict equality

typeof tour
typeof is fast for primitives. Note the legacy quirk: typeof null returns "object".
// typeof returns a string describing the type
console.log(typeof 42);
// "number"
console.log(typeof "hi");
// "string"
console.log(typeof true);
// "boolean"
console.log(typeof undefined);
// "undefined"
console.log(typeof 10n);
// "bigint"
console.log(typeof Symbol("x"));
// "symbol"
console.log(typeof null);
// "object" (historic quirk)

All lessons in this course
- Primitives vs Objects & Core Types
- typeof, Truthy/Falsy, and == vs ===
- Type Coercion: Safe Patterns to Avoid Surprises