I'm analysing javascript datatypes and I found something extremely strange:
> typeof null
"object"
> null instanceof Object
false
Currently I've got no idea how could I explain that. I thought that everything that has typeof === "object"
will have Object.prototype
in its prototype chain. If null
is not an object
, then why does typeof
return that?
PS somebody already wrote me welcome to the wacky world of javascript ;)