On Feb 8, 8:19 am, RobG <rg...@iinet.net.au> wrote:
[...]
> It can hardly be called a bug when it does what the documentation says
> it does (I think "works as designed" is the polite response).  The
> function itself is a bit pointless though, as are similar functions
> like isNumber, e.g.

It's not pointless, but the scope of its use is indeed pretty narrow.
Since neither `instanceof` operator nor `constructor` value check can
not be relied upon when working with multiple contexts (frames),
`Object.isString` is here to "take care" of it. AFAIK, ES committee is
planning to finally document ECMA behavior in context of multiple
global objects.

>
>   Object.isNumber(NaN); // true

Should it return `false`?

4.3.23 (NaN) says that "... This value is a member of the Number
type.". Also, `typeof NaN == "number"`, NaN's `constructor` is
`Number`, its [[Class]] is "Number" and it's [[Prototype]] references
`Number.prototype`? Should we return `false` for "practical" reasons?

And what should `Object.isNumber` return for +/-Inifinity? Adding
`isFinite` to `isNumber` would be able to take care of both - `NaN`
and `Infinity` cases.

--
kangax
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to