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/337fdb0248c5bcbd180b85e4661e5403 to your computer and use it in GitHub Desktop.
Save NyaGarcia/337fdb0248c5bcbd180b85e4661e5403 to your computer and use it in GitHub Desktop.
Merging arrays with the spread operator
const pokemon = ['Squirtle', 'Bulbasur', 'Charmander'];
const morePokemon = ['Totodile', 'Chikorita', 'Cyndaquil'];
const pokedex = [...pokemon, ...morePokemon];
console.log(pokedex); //Result: [ 'Squirtle', 'Bulbasur', 'Charmander', 'Totodile', 'Chikorita', 'Cyndaquil' ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment