I have an object o
which I want to desconstruct into pieces a
, b
, c
and d
. For now I am using three operations. I wonder if it can be done in one operation.
const o = {
a: {
b: "b-value",
c: {
d: "d-value"
}
}
}
This is how I did it in three operations (could it be done in only one?):
const { a } = o
const { b, c } = a
const { d } = c
Display the output:
console.log( {a,b,c,d} )