Created
March 2, 2017 07:51
-
-
Save frontsideair/8baf46d0b431b6aa0d5fb5fe49b12700 to your computer and use it in GitHub Desktop.
Objects and closures are (in some ways) the same thing! (Illustrated in ES6)
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 obj = { foo: 'bar', baz: 'quux' } // let's define our object | |
const { foo, baz } = bar // the keys are now in the envorinment! | |
const hello = 'world' // hello is defined in our environment | |
const newObj = { hello } // and now it's captured in our object! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment