Destructuring 将数组中的值或对象中的属性解包到不同的变量中,用一个易读的语句完成。
js
// array destructuring (by position)
const [first, second] = [10, 20]; // first=10, second=20
const [a, , c] = [1, 2, 3]; // skip the middle → a=1, c=3
{ name, age } = user;
{ : userName } = user;
{ city = } = address;
