//1. 数据
//a .常量
let username = 'admin' //声明 赋值
console.log(username) //更新
//b. 变量
const gender = '男' //创建常量时,必须初始化
console.log(gender)
const gender1 = '女'
console.log(gender1)
const xb = '男'
console.log(xb)
//2. 函数
//a .命名函数(先声明,后调用)
function sum1(a, b) {
return 'a + b= ' + (a + b)
}
console.log(sum1(1, 2))
//b. 匿名函数(函数表达式)
let num = function (a, b) {
return `${a} + ${b}= ` + (a + b)
}
console.log(num(4, 5))
//c. 箭头函数(匿名函数的简化)
let num1 = (a, b) => {
return `${a} + ${b}= ` + (a + b)
}
console.log(num1(6, 5))
uname = (a, b) => a + b
console.log(num(7, 5))
//d. 立即执行函数
+((a, b) => console.log(a + b))(100, 101)