append value in array javascript code example
Example 1: javascript append to array
var colors=["red","white"];
colors.push("blue");//append 'blue' to colors
Example 2: js add element to array
var fruits = [ "Orange", "Apple", "Mango"];
fruits.push("Banana");
Example 3: append item to array javascript
arr.push(item);
Example 4: how to insert a value into an array javascript
var list = ["foo", "bar"];
list.push("baz");
["foo", "bar", "baz"] // result