push object to array javascript code example
Example 1: js array add element
array.push(element)
Example 2: javascript append element to array
var colors= ["red","blue"];
colors.push("yellow");
Example 3: pushing to an array
array = ["hello"]
array.push("world");
console.log(array);
["hello", "world"]
Example 4: pushing element in array in javascript
array = ["hello"]
array.push("world");
Example 5: how to add objects in array
var a=[], b={};
a.push(b);
Example 6: javascript add object to array
var object = {'Name'};
var array = [ ];
array.push(object);
array.unshift(object);
array.splice(position, 0, object);