Data Structures and AlgorithmsQueues

A queue follows the FIFO (First In, First Out) principle. Elements are added to the rear and removed from the front. Useful in task scheduling, print queues, and order processing.

let queue = [];
queue.push(1);
queue.push(2);
console.log(queue.shift()); // Output: 1