Infinity 也是数(typeof Infinity 返回 number)

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