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"]
1let fruit = ['apple', 'banana']
2fruit.push('cherry')
3console.log(fruit) // ['apple', 'banana', 'chery']
1/*The push() method adds elements to the end of an array, and unshift() adds
2elements to the beginning.*/
3let twentyThree = 'XXIII';
4let romanNumerals = ['XXI', 'XXII'];
5
6romanNumerals.push(twentyThree);
7// now equals ['XIX', 'XX', 'XXI', 'XXII', 'XXIII']
8
9romanNumerals.unshift('XIX', 'XX');
10// now equals ['XIX', 'XX', 'XXI', 'XXII']