Skip to content

Instantly share code, notes, and snippets.

@NyaGarcia
Last active December 20, 2021 13:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NyaGarcia/c729a9688f89aa34503547e3a58d091c to your computer and use it in GitHub Desktop.
Save NyaGarcia/c729a9688f89aa34503547e3a58d091c to your computer and use it in GitHub Desktop.
Adding object properties with the spread operator
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