TypeofNullIsNull
DRAFT

Misconception:

The expression typeof null evalues to "Null".

Incorrect

The value null is of type 'null'

Correct

The value null is of type 'object'

Correction
Here is what's right.

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

Stay up-to-date

Follow us on  twitter to hear about new misconceptions.