js 数据类型 typeof的测试

时间:2023-03-09 01:50:09
js 数据类型 typeof的测试
 var t1 = ,
t2 = '',
t3 = null,
t4 = NaN,
t5 = undefined,
t6 = function() {},
t7 = true,
t8 = window,
t9 = document,
t10 = new Date(),
t11 = [],
t12 = {};
document.write(t1 + ' : ' + typeof t1 + '<br>' +
t2 + ' : ' + typeof t2 + '<br>' +
t3 + ' : ' + typeof t3 + '<br>' +
t4 + ' : ' + typeof t4 + '<br>' +
t5 + ' : ' + typeof t5 + '<br>' +
t6 + ' : ' + typeof t6 + '<br>' +
t7 + ' : ' + typeof t7 + '<br>' +
t8 + ' : ' + typeof t8 + '<br>' +
t9 + ' : ' + typeof t9 + '<br>' +
t10 + ' : ' + typeof t10 + '<br>' +
t11 + ' : ' + typeof t11 + '<br>' +
t12 + ' : ' + typeof t12 + '<br>');
这是输出结果:

js 数据类型 typeof的测试