源代码 :
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>开源教程(ossoft.cn)</title> </head> <body> <p>{} 转换为其他类型:</p> <p id="demo" style="font-family:courier"></p> <script> var x = {}; document.getElementById("demo").innerHTML = "Number : " + Number(x) + "<br>" + "String : " + String(x) + "<br>" + "Boolean: " + Boolean(x); </script> </body> </html>
运行结果