NaN 的类型是数字(没错!typeof NaN 返回 number)

  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4.  
  5. <h1>JavaScript 数字</h1>
  6.  
  7. <p>NaN 是数,typeof NaN 返回 number:</p>
  8.  
  9. <p id="demo"></p>
  10.  
  11. <script>
  12. var x = NaN;
  13. document.getElementById("demo").innerHTML = typeof x;
  14. </script>
  15.  
  16. </body>
  17. </html>
  18.  
  19.  
  20.