Correcting teacher:PHPz
Correction status:qualified
Teacher's comments:
function sum (a,b){
return a + b;
}
console.log(sum(5,5));
let ss = function (username){
return 'hello' + username;
}
console.log(ss('欧阳老师'));
let dd= ( function (username){
return 'hello' + username;
});
console.log(dd('贱人'));
console.log(function (username){
return 'hello' + username;
})('朱老师')
);
let abb =function (a,b){
console.log(a + b);
}
//使用箭头来简化匿名函数
abb = (a,b) =>{
console.log(a + b);
}
abb(1,2);
umberconsole.log(typeof 100);
stringconsole.log(typeof ('hello' +100) );
booleanconsole.log(typeof true);
undefinedconsole.log(undefined)
nullconsole.log(null)
arrconst arr =[1,2,35,8];
console.log(arr[2]);
objectconst obj={id:1,username:'pit',email:'lalal@qq.com'};
//obj 对象特有的访问方式
console.log(obj.email);
//1.数组访问方式
console.log(obj['username'])
functionfunction f2(){
//let a是私有变量
let a = 1;
return function (){
//子元素中的a此时是继承父元素的
return a++;
};
}
//打印第一个函数
//console.log(f2());
const f = f2();
console. log(f());
`let f3 = function() {};
f3.myemail = '1023621130@qq.com';
f3.username='lllll';
console.log(f3);
f3.getUser=function(){
console.log(this.username);
}
f3.getUser();