Types#
JavaScript has seven primitive types and one composite. Values
carry their type; variables do not. typeof x returns a
string tag. The operator’s edge-case file is built around the
coercion rules between these types.
For literals, see Syntax. For operators, see Operators.
The catalog#
Type |
What it holds |
|---|---|
|
The default value of an uninitialised binding. |
|
The intentional absence of a value. |
|
|
|
Double-precision IEEE 754 float. |
|
Arbitrary-precision integer (literal suffix |
|
UTF-16 code units; immutable. |
|
Unique, primitive identifier. |
|
Everything else; plain objects, arrays, functions, dates, errors, maps, sets, classes, promises. |
Primitives#
The default of an uninitialised binding.
The intentional absence of a value.
Truthiness rules and the falsy list.
IEEE 754 doubles; NaN, Infinity, Number.MAX_SAFE_INTEGER.
Arbitrary-precision integer; literal suffix n.
Immutable UTF-16 sequences; template literals, tagged templates.
Unique primitive identifiers; well-known protocols.
Composite#
Everything that is not a primitive: plain objects, arrays, functions, dates, errors.
Conversion#
Conversion between the primitive types and the
== / === coercion contrast.
References#
Syntax for literal forms.
Operators for
==vs===and coercion semantics.Data Structures for Array, Map, Set, TypedArray.
OOP for classes and prototypes.