javascript append to array
snippet in javascript

js array add element

user5854

array.push(element)

javascript append to array

user8575

var colors=["red","white"];
colors.push("blue");//append 'blue' to colors

append array js

user8424

var colors= ["red","blue"];
	colors.push("yellow"); //["red","blue","yellow"]

javascript append element to array

user925

var colors= ["red","blue"];
	colors.push("yellow"); 

javascript append to array

user6774

arr = [1, 2, 3, 4]
arr.push(5) // adds element to end

arr.unshift(0) // adds element to beginning

javascript append to array

user933


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

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