Created
October 21, 2015 13:38
-
-
Save jackfranklin/d0d7162c524aacbd285f to your computer and use it in GitHub Desktop.
Deep destructuring and renaming in ES6
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
function foo({ text, user: { screen_name: screenName }}) { | |
console.log('text', text); | |
console.log('name', screenName); | |
} | |
foo({ | |
text: 'hello world', | |
user: { screen_name: 'Jack' }, | |
}); | |
// => text 'hello world' | |
// => name 'Jack' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment