1some_array = ["John", "Sally"];
2some_array.push("Mike");
3
4console.log(some_array); //output will be =>
5["John", "Sally", "Mike"]
1array = ["hello"]
2array.push("world");
3
4console.log(array);
5//output =>
6["hello", "world"]
1var someArray = ["Item 1", "Item 2"];
2
3// Add a variable, string, number, or boolean to the array list
4someArray.push("Item 3");
5
6console.log(someArray);
7// This '.push()' method modifies the array to become something like this
8// someArray = ["Item 1", "Item 2", "Item 3"];
9
10// ===============================================================
11// You could also push more than one item into an array. Like this:
12var mainArray = ["Doe", "mizpah", "Tsukuyomi"];
13
14mainArray.push("Katara", 54, false, true);
15
16console.log(mainArray);
17// Result >>>
18// mainArray = ["Doe", "mizpah", "Tsukuyomi", "Katara", 54, false, true]
1let array = ["A", "B"];
2let variable = "what you want to add";
3
4//Add the variable to the end of the array
5array.push(variable);
6
7//===========================
8console.log(array);
9//output =>
10//["A", "B", "what you want to add"]