Is null an object or what? No, it's...
Per the language specification, the null
in JavaScript is a NullType
.
However, when do typeof null
, we get 'object'
. This kind of type is
called a 'trans type'.
Null is a NullType
born in the body of an object. Before calling typeof
on a
null value, you need to make sure you know the correct pronouns by asking it how
it would like to be referred to. Calling it an object is mistyping it, and is
socially unacceptable. The preferred pronouns are null
, == null
and
=== null
.
Speaking of which, NaN
is not a trans type. It's just... going through a
phase.