Removes the first element from an array and returns it.
Syntax
arr.shift()Example
Enter values below to update the example in real time.
const→queue→shift→console→const queue = [1, 2, 3];
const first = queue.shift();
console.log(first); // 1
console.log(queue); // [2, 3]