add item to end of array javascript code example
Example 1: javascript append element to array
var colors= ["red","blue"];
colors.push("yellow");
Example 2: javascript pushing to an array
some_array = ["John", "Sally"];
some_array.push("Mike");
console.log(some_array);
["John", "Sally", "Mike"]
Example 3: js add item to array
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.push("Kiwi");
Example 4: javascript array add end
let yourArray = [1, 2, 3];
yourArray.push(4);
Example 5: js push array
var array = [];
var element = "anything you want in the array";
array.push(element);
Example 6: javascript add items to array
objects = [];
objects.push("you can add a string,number,boolean,etc");
objects.push({variable1 : value, variable2 : value);