W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!DOCTYPE html> <html> <body> <p>如果值为 +infinity、-infinity 或 NaN,则 isFinite() 函数返回 false,否则返回 true。</p> <p>请单击按钮以检查数字是否是有限的合法数字。</p> <button onclick="myFunction()">试一试</button> <p id="demo"></p> <script> function myFunction() { var a = isFinite(123) + "<br>"; var b = isFinite(-1.23) + "<br>"; var c = isFinite(5-2) + "<br>"; var d = isFinite(0) + "<br>"; var e = isFinite("123") + "<br>"; var f = isFinite("Hello") + "<br>"; var g = isFinite("2005/12/12"); var res = a + b + c + d + e + f + g; document.getElementById("demo").innerHTML = res; } </script> </body> </html>