Copy the entire object into a variable
let {...obj} = {foo: 'aaa', bar: 'bbb'};
Get a value in the object
let {bar} = {foo: 'aaa', bar: 'bbb'};
console.log(bar ) // bbb
Get a value in the object, the variable name is different from the attribute name
let {foo: baz} = {foo: 'aaa', bar: 'bbb'};
console.log(baz) // aaa
Get the contents of the object array
let obj = {
p:['hello',{y: 'world'}]
}
let {p:[x, { y}]} = obj
console.log(x) // hello
console.log(y) // world