How does ES6 deconstruct: deconstruct part of an object's value to another variable?

for example, get a variable a , and this variable a may be an object returned by the server.

a: {
  name: "xiaobe",
  age: 22,
  title: "xxx"
}

I want to assign name and age of a to b (actually want to take out more attributes)

is there any quick and easy way? Now I think of deconstructing it like this:

const { name, age } = a;
b = { name, age }
May.14,2022

Why not?

 const b = {name:a.name,age:a.age}

const a = {name,age} = {name: 10, age: 20}
console.log (a) / / = > {name: 10, age: 20}
console.log (name) / / = > 10
console.log (age) / / = > 20
but name and age are global


b = {. Bpm. A}

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b37b31-2c0a8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b37b31-2c0a8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?