how to push item in array code example
Example 1: add item to list javascript
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.push("Kiwi"); // Fruits = ["Banana", "Orange", "Apple", "Mango", "Kiwi"];
Example 2: how to push items in array in javascript
let items = [1, 2, 3]
items.push(4); // items = [1, 2, 3, 4]
Example 3: how to insert a value into an array javascript
var list = ["foo", "bar"];
list.push("baz");
["foo", "bar", "baz"] // result
Example 4: array push
arr.push([element1[, ...[, elementN]]])