<body>
<script>
/* 数值类型 */
var num = 1;
console.log (typeof num);// number
/* 字符串类型 */
var str = '字符串';
console.log (typeof str);// string
/* 布尔类型 */
var boolean_True = true;
var boolean_False = false;
console.log (typeof boolean_True);// boolean
console.log (typeof boolean_False);// boolean
/* null类型 */
var text = null;
console.log (typeof text);//object
/* undefined类型 */
var unde = undefined;
console.log (typeof unde);//undefined
/* typeof 查看 typeof */
console.log (typeof(typeof num));//string
/* 复杂数据类型 object*/
var obj= {
'name':'张三',
'age':18,
'sex':'男'
}
console.log (typeof obj);// object
</script>
</body>
查看数据类型
最新推荐文章于 2023-04-25 17:20:36 发布