const arr = [1, 2, 3];

// Removes the first element from the array
arr.shift();
console.log(arr); // Output: [2, 3]
arr.shift()
// Initialize the array
const arr = [1, 2, 3];

// Remove the first element from the array
const removedItem = arr.shift();
console.log(arr); // Output: [2, 3]
console.log(removedItem); // Output: 1

// Empty array
const emptyArray = [];
const emptyArrayRemovedItem = emptyArray.shift(); // Array is empty, no element to remove

console.log(emptyArrayRemovedItem); // Output: undefined
const fruits = ["apple", "banana", "cherry"];
const removedFruit = fruits.shift();

console.log(removedFruit); // Output: "apple"
const fruits = ["apple", "banana", "cherry"];
const removedFruit = fruits.shift();

console.log(fruits.length); // Output: 2
const fruits = ["apple", "banana", "cherry"];

// Remove the first element
delete fruits[0];

// Print the array
console.log(fruits);   // Output: [<empty>, "banana", "cherry"]
console.log(fruits[0]); // Output: undefined
const numbers = [3, -2, 8, -5, 7, -1, 6];
const positiveNumbers = [];

while ((number = numbers.shift()) !== undefined) {
    if (number > 0) {
        positiveNumbers[positiveNumbers.length] = number; // Add only positive numbers to the new array
    }
}

console.log(positiveNumbers); // Output: [3, 8, 7, 6]