Number.isNaN

David Bruant bruant.d at gmail.com
Tue Dec 18 05:56:21 PST 2012


Le 18/12/2012 14:43, gaz Heyes a écrit :
> On 14 December 2012 16:39, Allen Wirfs-Brock <allen at wirfs-brock.com 
> <mailto:allen at wirfs-brock.com>> wrote:
>
>     No,  the whole point of Number.isNaN is to provide a definitively
>     test for NaN number values which  cannot be tested for in the
>     usual way using ===.   The definitiveness of the test would be
>     lost if other values such a Number wrapper instance also returned
>     true when passed as the argument for Number.isNaN.
>
>
> Why is it needed?
If anything, to explain devs that isNaN is broken and they should move 
to Number.isNaN.

> Can't we just simply do:
>
> function isReallyNaN(o) {
>  return o!=o&&isNaN(o);
> }
"o!=o" will be enough I think. You've got a polyfill :-)

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121218/8ccf9de5/attachment.html>


More information about the es-discuss mailing list