In the previous lesson, we created an array by listing all items inside square brackets. Real-world programs, however, often require adding items to an array after it's created.
That's where the push() method comes in. It adds a new item to the end of an array:
let fruits = ["apple", "banana"];
fruits.push("cherry");
// Now fruits is ["apple", "banana", "cherry"]The push() method modifies the original array by adding the new item at the end.
Use the push() method to add two more fruits to the array.
Output (Console)