, double quotes " ", or backticks ` `.
Boolean: Represents logical truth values — true or false.
When coerced to numbers, they become 1 and 0 respectively. Commonly used for conditional checks and control flow.
Undefined: Indicates a declared variable that has not been assigned a value. Conceptually borrowed from Scheme.
Null: Represents the intentional absence of any object value (an "empty" reference). Historically inspired by Java’s null.
BigInt: Used for integers larger than Number.MAX_SAFE_INTEGER (2^53 - 1), declared with an n suffix — e.g., 9007199254740993n.
Symbol: Represents unique and immutable identifiers, often used as object keys — no two symbols are ever equal.
Non-Primitive (Reference) Data Types
Non-primitive types are mutable and stored by reference.
Object: A collection of key–value pairs, where keys are strings or symbols.
Example: { name: "Priyasha", age: 25 }
Array: An ordered list of elements. Arrays in JavaScript are dynamic and actually specialized objects.
Example: [1, 2, 3]
Internally, arrays are objects optimized for indexed access. Their size and element types can change at runtime.
-
Function: A callable object. Functions are first-class citizens — they can be stored in variables, passed as arguments, and returned from other functions.
-
Date, RegExp, Map, Set, etc.: These are specialized object types with their own internal behaviors.
In summary, everything in JavaScript is either a primitive or an object.
Primitive values are simple and immutable, while objects are complex and mutable.
Some sources also include Date , Map , Set , and RegExp under non-primitive types, but they are best understood as specialized objects.