Last active
December 20, 2021 13:44
-
-
Save NyaGarcia/b70477b66182512f8e1585ac45bd4ba8 to your computer and use it in GitHub Desktop.
Adding an element to an array 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 pokemon = ['Squirtle', 'Bulbasur']; | |
const charmander = 'Charmander'; | |
const cyndaquil = 'Cyndaquil'; | |
const pokedex = [...pokemon, charmander, cyndaquil]; | |
console.log(pokedex); //Result: [ 'Squirtle', 'Bulbasur', 'Charmander', 'Cyndaquil' ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment