I want to destructure the values from the same object inside multiple objects.
const data ={
building1: {
floor: 'cnt',
}
building2: {
floor: 'bcnt'
}
}
Is there any way to destructure in single line as floor1, floor2
As simple as that:
const { building1: { floor: floor1 },building2: { floor: floor2 }} = data;