Fundamentals / Data Types
Data Types
Seven primitives, and one type that isn't: object.
JavaScript has seven primitive types — String, Number, Boolean, Undefined, Null, BigInt, and Symbol — plus Object, which covers arrays, functions, and plain objects. Primitives are compared and copied by value. Objects are compared and copied by reference.
`typeof null` famously returns "object" — a decades-old bug that's now permanent, so never rely on `typeof` to detect null. Use `value === null` instead.
Codeeditable — Run executes your edits
Loading...
Console
Output will appear here
Visualization
State
Step through — the console panel shows what's happening
Why?
typeof inspects the internal tag JavaScript stores alongside a value. null's tag was set to the same bit pattern as objects in the very first version of JS, and fixing it would break the web, so it stays.