const arr = [1, 2, 3];

// Add a single element to the end of the array
arr.push(4);
console.log(arr); // Output: [1, 2, 3, 4]

// Add multiple elements to the end of the array
arr.push(5, 6, 7);
console.log(arr); // Output: [1, 2, 3, 4, 5, 6, 7]
arr.push(element1)
arr.push(element1, element2)
arr.push(element1, element2, /* …, */ elementN)
const arr = [1, 2, 3];

// Add a new element to the end of the array and store the return
const totalElements = arr.push(4);
console.log(totalElements); // Output: 4
const fruits = ["apple", "banana", "cherry"];

// Add one element to the end of the array
fruits.push("date");

// Check the contents of the array
console.log(fruits); // Output: ['apple', 'banana', 'cherry', 'date']
const fruits = ["apple", "banana", "cherry"];

// Add elements to the end of the array
fruits.push("date", "elderberry");

// Print the updated array
console.log(fruits); // Output: ['apple', 'banana', 'cherry', 'date', 'elderberry']
const myArray = []; // Create an empty array

const object1 = {name: "John", age: 30};
const object2 = {name: "Jane", age: 25};

myArray.push(object1); // Add object to the end of the array
myArray.push(object2);

console.log(myArray);
// Output: [{name: 'John', age: 30}, {name: 'Jane', age: 25}]
const arr = [1, 2, 3];
const newArr = arr.concat(4);
console.log(newArr); // Output: [1, 2, 3, 4]
const arr = [1, 2, 3];
const newItem = 4;
const newArr = [...arr, newItem];
console.log(newArr); // Output: [1, 2, 3, 4]
const arr = [1, 2, 3];
arr[arr.length] = 4;
console.log(arr); // Output: [1, 2, 3, 4]