Destructuring Nested Objects in Javascript


Extract nested properties using object destructuring.

Source Code

let person = { name: 'John', address: { city: 'New York' } };
let { address: { city } } = person;
console.log(city);
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments