Created
October 19, 2018 18:07
-
-
Save MorenoMdz/baf3c8cf245e2cadaeb26c2aafaac90f to your computer and use it in GitHub Desktop.
ES2018 Examples
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
| // Spread to remove field | |
| const user = { | |
| firstName: 'John', | |
| lastName: 'Doe', | |
| city: 'Here' | |
| } | |
| const { city, ...userWIthoutCity} = user | |
| city // here | |
| userWIthoutCity // {firstName: 'John', lastName: 'Doe'} | |
| /* It takes the city and makes a new variable, then take the rest, and make another object. */ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment