array.concat in js code example
Example 1: javascript append to array
var colors=["red","white"];
colors.push("blue");
Example 2: javascript concat two arrays
const array3 = [...array1, ...array2];
Example 3: javascript concat
let chocholates = ['Mars', 'BarOne', 'Tex'];
let chips = ['Doritos', 'Lays', 'Simba'];
let sweets = ['JellyTots'];
let snacks = [];
snacks.concat(chocholates);
snacks.concat(chocolates, chips, sweets);
Example 4: concat js mdn
const array1 = ['a', 'b', 'c'];
const array2 = ['d', 'e', 'f'];
const array3 = array1.concat(array2);
console.log(array3);
Example 5: array concat in javascript
const letters = ['a', 'b', 'c'];
const numbers = [1, 2, 3];
const newArray = letters.concat(numbers);