const arr = [1, 2, 3];

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


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

// Add an element to the beginning of the array and store the return value.
const totalElements = arr.unshift(4);
console.log(totalElements); // Output: 4
const fruits = ["apple", "banana", "cherry"];

// Add one element to the beginning of the array
fruits.unshift("date");

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

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

// Check the contents of the array
console.log(fruits); // Output: ['date', 'elderberry', 'apple', 'banana', 'cherry']
const numbers = [1, 2, 3, 4, 5];
const reversedNumbers = [];

numbers.forEach(number => {
    reversedNumbers.unshift(number);
});

console.log(reversedNumbers); // Output: [5, 4, 3, 2, 1]