Created
December 13, 2018 15:51
-
-
Save icodesido/f93007f381e58cf132c5b11519ca1323 to your computer and use it in GitHub Desktop.
Complex Object destructuring
This file contains hidden or 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
| var aboutEdward = { | |
| info: ['Edward', 30], | |
| favColor: 'blue', | |
| favSushiRoll: 'Squidy squid squid' | |
| } | |
| function profilePage({favColor} = {favColor: 'vintage pink'}, [name, age] = ['Bunny', 24]) { | |
| console.log(`My name is ${name}. I am ${age} years old and my favorite color is ${favColor}!`) | |
| } | |
| profilePage(); | |
| // => My name is Bunny. I am 24 years old and my favorite color is vintage pink! | |
| profilePage({favColor: 'blue'}, ['Ed', 30]) | |
| // => My name is Ed. I am 30 years old and my favorite color is blue! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment