how to push an element into an array in javascript code example
Example 1: javascript append to array
var colors=["red","white"];
colors.push("blue");
Example 2: js array add element
array.push(element)
Example 3: javascript append element to array
var colors= ["red","blue"];
colors.push("yellow");
Example 4: js add item to array
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.push("Kiwi");
Example 5: javascript add items to array
objects = [];
objects.push("you can add a string,number,boolean,etc");
objects.push({variable1 : value, variable2 : value);
Example 6: how to push an element into an array in javascript
var arr = [
"Hi",
"Hello",
"Bonjour"
];
arr.push("Hola");
console.log(arr);