箭头函数

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// function func(){}
// 不带参数
let func = () => {
console.log("func");
}

// 第一个参数
let func_1 = x1 => {
console.log(x1);
}

// 带多个参数
let func_2 = (x1, x2) => {
console.log(x1, x2);
}

// 有返回值
let func_5 = () => 999 + 1;
// 等价于func_5
let func_6 = () => {
return 999 + 1;
}