Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

How to destructuring nested object value in javascript?

const person = {
    firstName: 'Adil',
    lastName: 'Arif',
    age: 25,
    job: 'web-developer',
    love: 'coding',
    friedsList: {
        friend1: 'Abir',
        friend2: 'Adnan'
    }
}
const { friend1, friend2 } = person.friedsList;
console.log(friend1, friend2);
//Expected output: Abir Adnan
Source by medium.com #
 
PREVIOUS NEXT
Tagged: #How #destructuring #nested #object
ADD COMMENT
Topic
Name
9+7 =