对字符串执行的算术将导致 NaN

  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4.  
  5. <h1>JavaScript 数字</h1>
  6.  
  7. <p>数字除以非数字字符串会成为 NaN (Not a Number):</p>
  8.  
  9. <p id="demo"></p>
  10.  
  11. <script>
  12. document.getElementById("demo").innerHTML = 100 / "Apple";
  13. </script>
  14.  
  15. </body>
  16. </html>