js 数据类型 typeof的测试

 1 var t1 = 1,
 2     t2 = '1',
 3     t3 = null,
 4     t4 = NaN,
 5     t5 = undefined,
 6     t6 = function() {},
 7     t7 = true,
 8     t8 = window,
 9     t9 = document,
10     t10 = new Date(),
11     t11 = [],
12     t12 = {};
13 document.write(t1 + ' : ' + typeof t1 + '<br>' + 
14             t2 + ' : ' + typeof t2 + '<br>' + 
15             t3 + ' : ' + typeof t3 + '<br>' + 
16             t4 + ' : ' + typeof t4 + '<br>' + 
17             t5 + ' : ' + typeof t5 + '<br>' + 
18             t6 + ' : ' + typeof t6 + '<br>' + 
19             t7 + ' : ' + typeof t7 + '<br>' + 
20             t8 + ' : ' + typeof t8 + '<br>' + 
21             t9 + ' : ' + typeof t9 + '<br>' + 
22             t10 + ' : ' + typeof t10 + '<br>' +
23             t11 + ' : ' + typeof t11 + '<br>' +
24             t12 + ' : ' + typeof t12 + '<br>');
这是输出结果:

posted @ 2016-08-18 10:52  to_Matthew  阅读(165)  评论(0编辑  收藏  举报