.shift() removes and returns the first array value.
.shift()
const queue = ["A", "B"]; const first = queue.shift();
Shift the first task into completedTask, then display it and the remaining tasks.
completedTask