W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!DOCTYPE html> <html> <body> <p>把 undefined 转换为其他类型:</p> <p id="demo" style="font-family:courier"></p> <script> var x = undefined; document.getElementById("demo").innerHTML = "Number : " + Number(x) + "<br>" + "String : " + String(x) + "<br>" + "Boolean: " + Boolean(x); </script> </body> </html>