Skip to main content

Data Types & Type Coercion

Learn Data Types & Type Coercion (JavaScript Fundamentals, JavaScript) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Primitive vs Reference Types JavaScript has 7 primitive types - string , number , boolean , undefined , null , symbol , bigint - and one reference type, object (arrays and functions are objects too). Primitives are copied by value; objects are copied by reference. typeof null famously returns "object" - a long-standing JavaScript bug kept for backward compatibility, not a design choice.

More lessons in JavaScript Fundamentals