We can use the destructuring assignment syntax to unpack a property of a given object and rename it:
const person = {
name: 'John Doe',
};
const { name } = person;
// Or unpack with other name
const { name: fullName } = person;
In the sample code above,
`fullName`
is an alias of the `name`
property. Both the `name`
and `fullName`
variables are `John Doe`
.