Last active
August 8, 2019 13:06
-
-
Save 12/6f6c11b4a64332a915ce513342688556 to your computer and use it in GitHub Desktop.
Destructuring
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 myObject = { | |
foo: 'hello', | |
bar: 'world', | |
baz: 'this', | |
}; | |
const { foo, bar, baz } = myObject; | |
console.log(foo); // 'hello' | |
console.log(bar); // 'world' | |
console.log(baz); // 'this' | |
// foo === myObject.foo | |
// rename 'foo' to 'qux' | |
const { foo: qux } = myObject; | |
console.log(qux) // 'hello' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment