Last active
March 13, 2020 13:03
-
-
Save nonseodion/192c7acdbf40183728d0623a88fd70a1 to your computer and use it in GitHub Desktop.
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
Damian = {age: 4, | |
hobby: "reading", | |
scores:{maths: 83, | |
english: 79, | |
writing: 44 | |
} | |
} | |
//it looks very similar to the basic destructuring syntax | |
//however you should note the nested object names are not assigned | |
//a value only the property names. | |
let {hobby, scores:{maths, english}} = Damian; | |
console.log("Damian loves "+hobby +" he had " + maths + | |
" in Math and " + english + " in English."); | |
//Damian loves reading he had 83 in Math and 79 in English. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment