Re:Oddities about JavaScript
by olavk on Monday May 30, 2011 @10:21AM
(#2599449)
The statement "Null is an Object" is probably more confusing than enlightening. I would prefer to say that typeof(null) non-intuitively returns the string "object".
[ Parent
| on HN ]
The ECMA standard supports your story. The `null' is the only instance of type `Null'. A Null instance does not have any properties; in particular, doesn't have the `constructor' property all actual object do.
What alert() does is an implicit conversion to string, and that is surprisingly defined to say "object" in ECMA standard. Could be matter of backward compatibility...