const people = [
{ name: "tom", gender: "boy" },
{ name: "mary", gender: "girl" },
];
for (let { name, gender } of people) {
console.log(`${name}: ${gender}`);
}
const obj = { a: 1, b: 2, c: 3, d: 4 };
const { a: e, ...f } = obj;
// f 包含了 obj 中除了 e 之外的属性
// 重命名属性名称
console.log(e, f);
const num = [1, 2, 3];
const [a, b, c, d = 4] = num;
// 默认值
console.log(a, b, c, d);