3 ms·
Can you reconcile what you've just said with this excerpt from your guide: > There's our first brush with JavaScript objects! Did I mention that strings are ob
by hmsimha 13y ago
Can you reconcile what you've just said with this excerpt from your guide:
> There's our first brush with JavaScript objects! Did I mention that strings are objects too? They have methods as well
Also, how do NaN and infinity fit in? I'm guessing they're special cases of Number types?
- inglor 13y agoGood question. First - this is _not_ my guide. MDN is a wiki and anyone can edit it. - NaN is just a number type . You have NaN in Java or C++ too. It's a way to represent "a number we can't represent" - Good catch on strings, I'll edit it in.
- ahoge 13y ago> Also, how do NaN and infinity fit in? I'm guessing they're special cases of Number types? Those are magical values from IEEE 754. IEEE 754 is also the reason why there is a signed zero or why division by zero results in +/- Infinity. >>> 0 === -0 true >>> 1/0 === 1/-0 // compares Infinity with -Infinity false
- raganwald 13y ago"hello" Not an object. new String("hello") Object. Along the way, autoboxing will convert a string to an object delegating to String.prototype if you write something like "hello".foobar(). But primitive value strings are not objects.