Answers for "how to destructure complex objects"

1

how to destructure complex objects

const sampleState = {
 name: “Michael”,
 age: 36,
 location: {
   state: “OK”,
   city: “Edmond”,
   postal: “73012”
 },
 relatives: {
   wife: {
   name: “Shelley”
   }
 }
}

const { age, location: { city, state }, relatives: { wife: { name } } } = sampleState
Posted by: Guest on January-23-2021

Code answers related to "how to destructure complex objects"

Code answers related to "Javascript"

Browse Popular Code Answers by Language