Created
October 26, 2018 23:48
-
-
Save jchiatt/16e80bb13f5c941f8b603986bbd5bb04 to your computer and use it in GitHub Desktop.
Final code for Destructuring Nested Objects in JavaScript Video
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const benchPress = { | |
muscles: { | |
primary: "Chest", | |
secondary: "Triceps" | |
}, | |
oneRepMax: { | |
variations: { | |
standard: { | |
lbs: 315, | |
kgs: 142.882 | |
} | |
} | |
} | |
}; | |
const { | |
muscles: { secondary } | |
} = benchPress; | |
console.log(secondary); // returns 'Triceps' | |
const { | |
oneRepMax: { | |
variations: { | |
standard: { lbs } | |
} | |
} | |
} = benchPress; | |
console.log(lbs); // returns 315 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment