JAVASCRIPT Tutorial
shift() method on the array.const array = [1, 2, 3, 4, 5];
const removedElement = array.shift(); // 1
console.log(array); // [2, 3, 4, 5]
console.log(removedElement); // 1
shift() returns undefined.shift() is useful for removing the first element from an array when you need to access the removed element.shift() modifies the original array.