As I delve into the realm of JavaScript data types, I stumbled upon a peculiar discovery:
> typeof null
"object"
> null instanceof Object
false
At this point, I am baffled as to how to make sense of this phenomenon. I was under the assumption that anything with typeof === "object"
would have Object.prototype
in its prototype chain. If null
is not considered an object
, then why is typeof
returning that?
Someone aptly remarked to me, welcome to the wacky world of JavaScript ;)