Answers for "add an array to another array javascript"

3

assign array to another array javascript

var ar = ["apple","banana","canaple"];
var bar = Array.from(ar);
alert(bar[1]); // alerts 'banana'

// Notes: this is for in In ES6, works for an object of arrays too!
Posted by: Guest on July-02-2020
0

add an array to another array javascript

var array1 = ['Hamburger', 'Fries']
var array2 = ['Salad', 'Fruits']

var combinedArray = array1.concat(array2); // => ['Hamburger', 'Fries', 'Salad', 'Fruits']
Posted by: Guest on August-01-2021
6

concat js mdn

const array1 = ['a', 'b', 'c'];
const array2 = ['d', 'e', 'f'];
const array3 = array1.concat(array2);

console.log(array3);
// expected output: Array ["a", "b", "c", "d", "e", "f"]
Posted by: Guest on March-11-2020

Code answers related to "add an array to another array javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language