1some_array = ["John", "Sally"];
2some_array.push("Mike");
3
4console.log(some_array); //output will be =>
5["John", "Sally", "Mike"]
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"]
1var fruits = ["Orange", "Apple", "Mango"];
2var moreFruits = ["Banana", "Lemon", "Kiwi"];
3
4fruits.push(...moreFruits);
5//fruits => ["Orange", "Apple", "Mango", "Banana", "Lemon", "Kiwi"]
6
1const langages = ['Javascript', 'Ruby', 'Python'];
2langages.push('Go'); // => ['Javascript', 'Ruby', 'Python', 'Go']
3
4const dart = 'Dart';
5langages = [...langages, dart]; // => ['Javascript', 'Ruby', 'Python', 'Go', 'Dart']