append to array js
snippet in javascript

append to array js

user5500

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

append array js

user2712

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

js push array

user6972

array.push(element_to_push);

add value to array javascript

user1661

var fruits = ["222", "vvvv", "eee", "eeee"];

fruits.push("Kiwi"); 

javascpirt push in aray

user2827


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

fruits.push("Kiwi"); 

console.log(fruits) // ["Banana", "Orange", "Apple", "Mango", "Kiwi"]

js add item to array

user8613

const fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.push("Kiwi");