1-1 变量
1-2 变量命名规则
1、不能以数字开头
2、不能包含算数运算符,逻辑运算符,或特殊字符(#,etc)
3、不能使用关键字,保留字作为标示符
4、由字母,数字,下划线(_)或美元符号($)组成
1-3基本数据类型
1-4数组
数组声明
var a=[1,2,3]
数组访问
console.log(a[1]);
数组长度
console.log(a.length);
数组方法
a.push(4,5,6);
console.log(a); //1,2,3,4,5,6
a.unshift(0);
console.log(a); //0,1,2,3,4,5,6
1-5 json对象
key:value
var myFamilies=[
{
relationship:"父亲",
name:"雷云",
age:"50",
hobby:["抽烟","喝酒","赌博"],
work:"退休"
},
{
relationship:"母亲",
name:"黄丽娟",
age:"50",
hobby:["广场舞","散步","唱歌"],
work:"退休"
},
{
relationship:"兄",
name:"雷浩然",
age: 30,
hobby:["摄影","看电影"],
work:"公务员"
}
];