Number.isNaN

Brendan Eich brendan at mozilla.com
Fri Dec 14 12:01:28 PST 2012


Domenic Denicola wrote:
>> From: es-discuss-bounces at mozilla.org [es-discuss-bounces at mozilla.org] on behalf of Nathan Wall [nathan.wall at live.com]
>> Sent: Friday, December 14, 2012 13:34
>
>> On another note, I do sort of wonder why `Number.isNaN` is coming into the language now at the same time as the `is` operator and `Object.is`.  It seems teaching people (and getting them to remember long-term) the nuances of `isNaN` and `Number.isNaN` will be more difficult than just teaching people to use `x is NaN` in ES6 or `Object.is(x, NaN)` in an ES3/5 + ES6 shims environment.
>
> `is` operator is dead :( :( :(

Restricted productions creating new operators may be at risk (Allen's 
right, we haven't had an orderly decision in TC39 on this point), but 
Object.is or Object.isSameValue is definitely not dead.

Allen's right too that we have some disagreement on the use of SameValue 
under the hood in Map and Set.

/be

>
> (Someone want to find a link to the minutes that killed it? I keep having to correct people on this.)
>
>> There's not an `isNull` or `isUndefined`. The only reason `isNaN` was needed was because `===` didn't work with `NaN`, but `is` does.
>
> This is pretty reasonable, actually. The only argument I can see is that `array.filter(Number.isNaN)` is shorter than `array.filter(x =>  Object.is(x, NaN))`.
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>


More information about the es-discuss mailing list