1. 对象解构
let person = {
name: "Semlinker",
gender: "Male",
};
let { name, gender } = person;
1
2
3
4
5
6
7
2. 对象展开运算符
let person = {
name: "Semlinker",
gender: "Male",
address: "Xiamen",
};
let personWithAge = { ...person, age: 33 };
let { name, ...rest } = person;
1
2
3
4
5
6
7
8
9
10
11