JavaScript primitive types

JavaScript's primitive types are number, string, boolean, undefined, null, bigint, and symbol. They are immutable and compared by value. Everything else, such as objects, arrays, and functions, is of the object type. The typeof operator returns the type of a value.

Example

typeof 'a'  // 'string'
typeof 42   // 'number'
typeof null // 'object' (historical quirk)

Related concepts

The whole glossary