According to the spec there are only 6 types, 5 of which are native ( Null, Undefined, Number, String, Boolean ) and 1 which is of type Object.
It appears that typeof
fails for null
and detects it as an object.
It also seems that toString()
will report Object descendants as their descendant type, for example RegExp
, Function
, etc.
I don't want the descendant type, I want RegExp
, Function
, etc. reported as Object
.
I basically want to detect true ES5 Objects.