Is it possible to rename a variable when destructuring a nested object in JavaScript? Consider the following code:
const obj = {a: 2, b: {c: 3}};
const {a: A, b:{c}} = obj;
How can I rename c
in above code like I renamed a
to A
?
const {a: A, b:{c}: C} = obj
doesn't work.