Last active
December 20, 2021 13:44
-
-
Save NyaGarcia/c729a9688f89aa34503547e3a58d091c to your computer and use it in GitHub Desktop.
Adding object properties with the spread operator
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
const basicSquirtle = { name: 'Squirtle', type: 'Water' }; | |
const fullSquirtle = { | |
...basicSquirtle, | |
species: 'Tiny Turtle Pokemon', | |
evolution: 'Wartortle' | |
}; | |
console.log(fullSquirtle); //Result: { name: 'Squirtle', type: 'Water', species: 'Tiny Turtle Pokemon', evolution: 'Wartortle' } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment