源代码
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>享学课堂</title> </head> <body> <p>如果你在数学运算中使用NaN,结果也会是NaN:</p> <p id="demo"></p> <script> var x = NaN; var y = 5; document.getElementById("demo").innerHTML = x + y; </script> </body> </html>
运行结果