You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
check-types ensures that case of native types is the same as in this list:
boolean
number
string
Object
Array
Date
RegExp
There is probably a good reason, but why are boolean, number, string in lower case, but the rest upper case?
I get that you can do new Object(), new Array() etc. but you cannot do new number(), it must be new Number().
I also get that typeof new Array will say object even though we decided that the type is Object. So the typeof function doesn't really give the type, just a lowercase translation of the parent type, which is Object and not object. Shouldn't we treat all cases the same?
(new Array()).constructor.name
"Array"
(new Number()).constructor.name
"Number"
(new Function()).constructor.name
"Function"
(new Boolean()).constructor.name
"Boolean"
I think either string, number and boolean should also be capitalized, or object should be with a lower case because typeof Object() is object.
Am I wrong?
The text was updated successfully, but these errors were encountered:
There is probably a good reason, but why are
boolean
,number
,string
in lower case, but the rest upper case?I get that you can do
new Object()
,new Array()
etc. but you cannot donew number()
, it must benew Number()
.I also get that
typeof new Array
will sayobject
even though we decided that the type isObject
. So thetypeof
function doesn't really give the type, just a lowercase translation of the parent type, which isObject
and notobject
. Shouldn't we treat all cases the same?I think either
string
,number
andboolean
should also be capitalized, orobject
should be with a lower case becausetypeof Object()
isobject
.Am I wrong?
The text was updated successfully, but these errors were encountered: