Q:

javascript append array to array

var colors=["red","white"];
colors.push("blue");//append 'blue' to colors
79
const array1 = ['a', 'b', 'c'];
const array2 = ['d', 'e', 'f'];
const array3 = array1.concat(array2);
1

var hege = ["Cecilie", "Lone"];

var stale = ["Emil", "Tobias", "Linus"];

var kai = ["Robin"];

var children = hege.concat(stale, kai); 
-1
arr = [1, 2, 3, 4]
arr.push(5) // adds element to end

arr.unshift(0) // adds element to beginning
1
const new_array = old_array.concat([value1[, value2[, ...[, valueN]]]])
1

var fruits = ["Banana", "Orange", "Apple", "Mango"];

fruits.push("Kiwi"); .cut-text { 
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
0

New to Communities?

Join the community