Created
May 2, 2018 21:08
-
-
Save sarahquigley/3fbf771ea55ab497894fa4af864c3d06 to your computer and use it in GitHub Desktop.
Example of ES2018 Object Destructuring Assignment - Spread Operator
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
/* < ES2018 */ | |
var catMaru = { name: 'Maru', mittens: true, color: 'tabby' }; | |
var name = catMaru.name; | |
var coat = {}; | |
coat.mittens = catMaru.mittens; | |
coat.color = catMaru.color; | |
/* >= ES2018 */ | |
var catMaru = { name: 'Maru', mittens: true, color: 'tabby' }; | |
var { name, ...coat } = catMaru; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment