Correcting teacher:天蓬老师
Correction status:qualified
Teacher's comments:
let age = 50; 整数
let num=3.1415926; 小数
let name = apple;
let emali = "zhangbeijing@163.com";
let isMarr = true; /*或者false*/
未初始化变量的默认值
let gender;
console.log(gender); //undeifned
let pro = null;
console.log(pro,typeof null); //返回的是object
let s Symbol('custom symbol');
console.log(s,typeof s);
console.log(age,typeof age);
console.log('邮箱' + email);
let a = 100;
// 将变量的a的值,传递到了b;
let b = a;
console.log(b);
let a = 200;
console.log(b);
// a的更新不会影响到b
10-1 对象字面量:
let user = {
// 属性,相当于变量
id:1,
name:'zhangzhongguo',
'my email':'123456@qq.con',
// 方法:函数
getName:function(){
//this表示当前的上下文,当前对象
return '我的名字叫:'+ this.name;
}
}
console.log(user.id,user.name);
console.log(user['my email']);
console.log(user.getName());
10-2 数组:
let course = [5,'javascript','php.cn'];
//访问数组中的第二个值
console.log(course[1]);
10-3 函数:
function hello(){}
console.log(hello,typeof hello);
console.log(hello,instanceof Object);
// 对象是属性的无序集合,对象可以添加属性
hello.email = '123456@qq.com';
console.log(hello.email);