JavaScript变量
1,变量是用来储存信息的“容器”
例:var x = 10;
var y = 10.1;
var z = “Hello”;
<!--声明一个变量-->
<script>
var i = 10;
var j = 10;
var m = i+j;
document.write(m);
</script>
JavaScript数据类型
1,字符串(String)
2,数字(Number)
3,布尔(Boolean)
4,数组(Array)
5,对象(Object)
6,空(null)
7,未定义
8,可以通过赋值为null的方式清除变量
<body>
<!--声明一个变量-->
<script>
var i = 10;
var j = 10;
var m = i+j;
document.write(m);
</script>
<script>
var string = "hello";//字符串
var i1 = 10;//数字
var flag = true;//boolean类型
var arr = [1,2,3,4];//数组
document.write(arr[1]);
var arr1 = ["ni","hao","ma"];
document.write(arr1);
var arr2 = new Array["wo","shi","hao","ren"];
document.write(arr2);
var arr3 = new Array();
arr3[0] = 10;
arr3[1] = 20;
document.write(arr3);
var n = null;
</script>
</body>