list js add code example
Example 1: javas script add list
var arr = [
"Hi",
"Hello",
"Bonjour"
];
arr.push("Osamah");
console.log(arr);
Example 2: javascript pushing to an array
some_array = ["John", "Sally"];
some_array.push("Mike");
console.log(some_array);
["John", "Sally", "Mike"]
Example 3: add item to list javascript
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.push("Kiwi");
Example 4: js push array
var array = [];
var element = "anything you want in the array";
array.push(element);