作业内容:1. 变量,常量,数据类型,实例演示,注意命名规范;
//变量
let n1 = 100;
console.log(typeof n1);
let n2 = "123";
console.log(typeof n2);
let n3 = true;
console.log(typeof n3);
let n4 = undefined;
console.log(typeof n4);
let n5 = null;
console.log(typeof n5);
//常量
const NATION = "china";
//对象
const person = {
name:'zhangsan',
gender:'male',
job:'work'
};
console.log(person);
//数组
const colors =["red","green","blue"];
console.log(colors);
2. 函数参数与返回值,匿名函数及箭头函数的转化,实例演示;
//函数参数与返回值
function sum (a,b){
return a+b;
}
console.log(sum(30,40));
//匿名函数与箭头函数的转化
let sum1 = function(a,b){
return a+b;
}
sum1 = (a,b)=>{
return a+b;
}
//只有一条语句时
sum1 =(a,b)=>a+b;