Number.isNaN

John-David Dalton john.david.dalton at gmail.com
Thu Dec 13 21:46:40 PST 2012


> Honest question: I have yet to see boxed values in practice. Are there
any real use cases?

See Modernizr:
https://github.com/Modernizr/Modernizr/blob/master/feature-detects/video.js#L23

-JDD


On Thu, Dec 13, 2012 at 8:26 PM, Axel Rauschmayer <axel at rauschma.de> wrote:

> Honest question: I have yet to see boxed values in practice. Are there any
> real use cases?
>
> [[[Sent from a mobile device. Please forgive brevity and typos.]]]
>
> Dr. Axel Rauschmayer
> axel at rauschma.de
> Home: http://rauschma.de
> Blog: http://2ality.com
>
> On 14.12.2012, at 05:18, Luke Hoban <lukeh at microsoft.com> wrote:
>
> >>> From: Mark S. Miller [mailto:erights at google.com]
> >>>
> >>> In that case, the current spec is wrong. The purpose of introducing
> Number.isNaN is to repair the >> following bug in the global isNaN:
> >>>
> >>>    isNaN("foo") // returns true
> >
> > Indeed, as Yusuke noted on the other reply, I referred to the wrong
> 'isNaN'.  And as you note, the point of the 'Number.isNaN' variant is to
> avoid any coercions.
> >
> > That still leave's JDD's original suggestion to allow
> Number.isNaN(Object(NaN)) to return 'true' by checking for either primitive
> or boxed Number.  It feels a little odd to introduce another kind of
> limited coercion into the language, but perhaps it is practically valuable
> to not differentiate boxed and unboxed numbers here?
> >
> > Luke
> >
> > _______________________________________________
> > es-discuss mailing list
> > es-discuss at mozilla.org
> > https://mail.mozilla.org/listinfo/es-discuss
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121213/232341d2/attachment.html>


More information about the es-discuss mailing list