Created
July 19, 2018 01:50
-
-
Save theRemix/d729865f7473fda668d431be9ed910de to your computer and use it in GitHub Desktop.
Nested Destructuring Styles
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
const data = { | |
cat : { | |
dog : { | |
bird : { | |
mouse : "squeek" | |
} | |
} | |
} | |
}; | |
const say1 = input => { | |
console.log('say1 mouse', input.cat.dog.bird.mouse ); | |
} | |
const say2 = ({ cat : { dog : { bird : { mouse }}}}) => { | |
console.log('say2 mouse', mouse ); | |
} | |
const say3 = input => { | |
const { cat : { dog : { bird : { mouse }}}} = input; | |
console.log('say3 mouse', mouse ); | |
} | |
say1( data ); | |
say2( data ); | |
say3( data ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
output :