源代码
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>享学课堂</title> </head> <body> <p>显示NaN的布尔值:</p> <button onclick="myFunction()">试试</button> <p id="demo"></p> <script> function myFunction() { var x = 10 / "H"; document.getElementById("demo").innerHTML = Boolean(x); } </script> </body> </html>
运行结果