add object value to array javascript code example
Example 1: js add item to array
const fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.push("Kiwi");
Example 2: javascript add object to array
var object = {'Name'};
var array = [ ];
array.push(object);
array.unshift(object);
array.splice(position, 0, object);
Example 3: how to add object to array javascript
var object = "Some Object"
var array = []
array.push(object)
Example 4: how to add new object in array in javascript
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.push("Kiwi");