const a = { b: { c: 'Hi!' } }; const { b: { c } } = a;
Is it possible rename b in this case? I want get c and also rename b.
b
c
You could destructure with a renaming and take the same property for destructuring.
const a = { b: { c: 'Hi!' } }; const { b: formerB, b: { c } } = a; console.log(formerB) console.log(c);
1.4m articles
1.4m replys
5 comments
57.0k users