naming - Case of names of built-in JavaScript types -
in javascript, typeof 0
gives 'number'
not 'number'
, instanceof 0 number
.
would accurate canonical names of built-in types capitalized, , lowercase return value of typeof
quirk/inconsistency can't changed historical reasons, changed if be? or missing something?
no,
actually number built-in value type number object.
if typeof there's no need temporarily convert 0 object.
if use instanceof, temporarily converts 0 object.
this similar string:
"sometest"
=> string
however, if "sometest".tolowercase()
first (temporarily) convert string string-object , call method on object (since value-types can't have methods).
in short, lowercase means value-type, uppercase means object
Comments
Post a Comment