Skip to content
Better HN
Top
New
Best
Ask
Show
Jobs
Search
⌘K
undefined | Better HN
0 points
gavinray
5y ago
0 comments
Share
A JS integer is actually an instance of the "Number" object, you can to a small degree alter fundamental behavior even with primitive types
0 comments
default
newest
oldest
jiofih
5y ago
No it is not. It is a primitive, this difference is well defined in the ECMAScript spec. Same for strings. An instanceof String is strictly
not
the same as a string primitive (and there are runtime consequences).
_v7gu
5y ago
You need to enclose numbers to access the prototype: 1.toString is undefined, whereas (1).toString() is "1"
hosh
5y ago
I stand corrected.
j
/
k
navigate · click thread line to collapse