Constructor
new Queue()
- Description:
- Creates a new queue.
- Source:
Examples
// without chaining
const queue = new Queue();
queue.push(top);
queue.push(middle);
queue.push(bottom);
// with chaining
const queue = new Queue().push(top).push(middle).push(bottom);
Methods
clear() → {this}
- Description:
- Clears the queue.
- Source:
Returns:
- Type
- this
pop() → {T|undefined}
- Description:
- Pops an item.
- Source:
Returns:
- Type
- T | undefined
push($item) → {this}
- Description:
- Pushes an item.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
$item |
T | The item to push. |
Returns:
- Type
- this