W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!DOCTYPE html> <html> <body> <h1>JavaScript 对象构造器</h1> <p id="demo"></p> <script> var x1 = {}; // 对象 var x2 = ""; // 字符串 var x3 = 0; // 数字 var x4 = false; // 布尔 var x5 = []; // 对象(非数组) var x6 = /()/; // 对象 var x7 = function(){}; // 函数 // 显示所有类型 document.getElementById("demo").innerHTML = "x1: " + typeof x1 + "<br>" + "x2: " + typeof x2 + "<br>" + "x3: " + typeof x3 + "<br>" + "x4: " + typeof x4 + "<br>" + "x5: " + typeof x5 + "<br>" + "x6: " + typeof x6 + "<br>" + "x7: " + typeof x7 + "<br>"; </script> </body> </html>