NaN

 1     function w(w){console.log(w)}    
 2     w(null == null);
 3     w(null === null);
 4     w(NaN == NaN); //false
 5     w(NaN === NaN); //false
 6     w(NaN); //NaN
 7     w('2' == 2) //true
 8     w('2' === 2); //false
 9     w(null == undefined) //true
10     w(null === undefined) //false

 ECMA-262_ECMAScript®2015 Language Specification

 

6.1.6
The  Number  type  has  exactly 18437736874454810627(that  is, 264-253+3) values,
representing  the  double-precision  64-bit  format  IEEE  754-2008values  as  specified  in  the  IEEE  Standard  for  Binary  Floating-Point Arithmetic,  except  that  the 9007199254740990(that  is, 253-2)  distinct  “Not-a-Number”  values of  the  IEEE Standard are represented in ECMAScript as a single special NaN value. (Note that the NaN value is produced by the program expression NaN.)
In some implementations, external code might be able to detect a difference between various Not-a-Number values, but such behaviour is implementation-dependent; to ECMAScript code, all NaN values are indistinguishable from each other.

posted @ 2016-08-20 00:20  papering  阅读(188)  评论(0编辑  收藏  举报