Created
November 24, 2021 19:27
-
-
Save catwhocode/d6d5858b1c68b824d9c889f1e1e926a1 to your computer and use it in GitHub Desktop.
Combining Array using 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
// source: | |
// https://dev.to/sagar/three-dots---in-javascript-26ci | |
const featured = ['Deep Dish', 'Pepperoni', 'Hawaiian']; | |
const specialty = ['Meatzza', 'Spicy Mama', 'Margherita']; | |
const pizzas = [...featured, 'veg pizza', ...specialty]; | |
console.log(pizzas); | |
// 'Deep Dish', 'Pepperoni', 'Hawaiian', 'veg pizza', 'Meatzza', 'Spicy Mama', 'Margherita' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment