const user = {
nested: {
a: 'foo',
b: [
'first item',
'second item',
'third item',
]
}
}
const {
nested: {
a,
b: [first, , third]
}
} = user
console.log({ a, first, third })
const employees = {
engineers: [
{
id: 1,
name: "John Doe",
occupation: "Back-end Engineer"
},{
id: 2,
name: "Jane Doe",
occupation: "Front-end Engineer"
},
]
};
const {
engineers: {
1: secEng,
},
} = employees;
console.log("secEng: ", secEng);