Remove element from the start of a queue
self reference
const q = new Queue();q.enqueue(1).enqueue(2).enqueue(3).dequeue() // 1 <= 2
Add element at the end of the queue
const q = new Queue();q.enqueue(1).enqueue(2).enqueue(3) // 1 <= 2 <= 3
first element in the queue
const q = new Queue();const first = q.enqueue(1).enqueue(2).first();console.log(first); // 1
the current size of the queue
const q = new Queue();const currentSize = q.enqueue(1).enqueue(2).getSize();console.log(currentSize); // 2
last element in the queue
const q = new Queue();const last = q.enqueue(1).enqueue(2).last();console.log(last); // 2
a visual representation of the queue
const q = new Queue();q.enqueue(1).enqueue(2).view(); // Start <--- 1 <--- 2 <--- End
Generated using TypeDoc
Remove element from the start of a queue
Returns
self reference
Example