JSFiddle - React, Tailwind, and code Playground
by Abdul Ahmad
JavaScript
const ob = {
A_1: {
A_1_B_1: 'A_1_B_1'
},
A_2: {
A_2_B_1: {
A_2_B_1_C_1: 'A_2_B_1_C_1',
},
}
};
const {
A_1,
// - A_2 here will not be assigned because
// there's already an A_2 in the original object
// - so A_2_B_2 will be undefined and throw a reference
// error
A_2: { A_2_B_2 } = {
A_2_B_2: 'A_2_B_2 default',
},
A_3 = {
A_3: { A_3_B_1 } = {
A_3_B_1: { A_3_B_1_C_1 } = {
A_3_B_1_C_1: { A_3_B_1_C_1_D_1 } = {
A_3_B_1_C_1_D_1: 'A_3_B_1_C_1_D_1 default'
}
}
}
}
} = ob;
console.log(A_2_B_2);