1const person = {
2 firstName: 'Adil',
3 lastName: 'Arif',
4 age: 25,
5 job: 'web-developer',
6 love: 'coding',
7 friedsList: {
8 friend1: 'Abir',
9 friend2: 'Adnan'
10 }
11}
12const { friend1, friend2 } = person.friedsList;
13console.log(friend1, friend2);
14//Expected output: Abir Adnan
1var personsInfo = {
2 company: 'sp-coder',
3 persons: [{
4 id: 1,
5 name: 'Adil',
6 friedsList: {
7 friend1: 'Nabil',
8 friend2: 'Habib'
9 }
10 }, {
11 id: 2,
12 name: 'Arif',
13 friedsList: {
14 friend1: 'alvi',
15 friend2: 'avi'
16 }
17 }]
18};
19
20const { friend1, friend2 } = personsInfo.persons[0].friedsList;
21console.log(friend1, friend2);
22// Expected Output: Nabil Habib