DRAFT
Observed
The value null is of type 'null'
The value null is of type 'object'
In JavaScript null
represents the intentional absence of any object value.
In the specification null
is the sole value of the Null
type, nevertheless, because of legacy reasons, the expressions typeof null
returns the value object
:
typeof null === "object"; // true
By assigning the value null
to a variable, its type changes to object
:
let num = 1;
typeof num === "number"; // true
num = null;
typeof num === "number"; // false
typeof num === "object"; // true
Follow us on twitter to hear about new misconceptions.