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.

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-24
  • 2021-05-21
  • 2021-06-10
  • 2022-01-01
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-09
  • 2021-10-20
  • 2021-04-14
  • 2022-02-15
  • 2022-12-23
相关资源
相似解决方案