append array in array javascript code example
Example 1: javascript append to array
var colors=["red","white"];
colors.push("blue");
Example 2: javascript append element to array
var colors= ["red","blue"];
colors.push("yellow");
Example 3: javscript append item from array
let foo = ['oop','plop','copo'];
foo.push("plop");
Example 4: javascript append element to array
var arr = [
"Hi",
"Hello",
"Bonjour"
];
arr.push("Hola");
console.log(arr);
Example 5: how to append an element to an array in javascript
array_name.push(element);
let fruits = ["Mango", "Apple"];
fruits.push("Orange");
Example 6: javascript append to array
arr = [1, 2, 3, 4]
arr.push(5)
arr.unshift(0)