Skip to content

Instantly share code, notes, and snippets.

View Mohamed-Code-309's full-sized avatar
🎯
Focusing

Mohamed Jebril Mohamed-Code-309

🎯
Focusing
View GitHub Profile
@NyaGarcia
NyaGarcia / merge-object-arrays.js
Created September 12, 2019 11:47
Merging object arrays with spread operator
const pokemon = [
{ name: 'Squirtle', type: 'Water' },
{ name: 'Bulbasur', type: 'Plant' }];
const morePokemon = [{ name: 'Charmander', type: 'Fire' }];
const pokedex = [...pokemon, ...morePokemon];
console.log(pokedex); //Result: [ { name: 'Squirtle', type: 'Water' }, { name: 'Bulbasur', type: 'Plant' }, { name: 'Charmander', type: 'Fire' } ]
@NyaGarcia
NyaGarcia / merge-arrays.js
Last active December 20, 2021 13:44
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' ]