Created
December 1, 2018 14:49
-
-
Save talitaoliveira/dd36fd8a9fb9b2973a73829a7f7a67d5 to your computer and use it in GitHub Desktop.
Using the new feature of ES9: Rest Properties for objects
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
/** | |
* REST PROPERTIES | |
* Using the REST operator "..." to extract properties from an object | |
* */ | |
const { website, ...moreInfo } = { | |
website: 'http://rec.jsday.com.br/', | |
day: 1, | |
month: 12, | |
year: 2018, | |
location: 'Faculdade Imaculada conceição' | |
}; | |
console.log(website); // http://rec.jsday.com.br/ | |
console.log(moreInfo); // {day: 1, month: 12, location: "Faculdade Imaculada conceição"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment