一、6种数据类型(一说7种)
<meta charset="utf-8" />
<script type="text/javascript">
// 数据类型 数字、字符串、布尔、对象、null、undefined、数组
// 数字
var num = 2;
var num2 = 2.30;
show(typeof num);
// 字符串
var str = 'abc';
var str2 = "123";
show(typeof str);
// 布尔
var boo1 = true;
var boo2 = false;
show(typeof boo1);
// 对象
var obj = {
name: '张三',
age: 18
}
show(typeof obj);
// null
var aa = null;
show(typeof aa);
// undefined
var bb;
show(typeof bb);
// 数组
var arr = ['a', 2, null];
show(typeof arr);
function show(data) {
document.write(data);
document.write('<br />');
}
</script>
基本数据类型和引用数据类型
- 基本数据类型
- 引用数据类型