Constructor
new Queue()
Start with an empty array and store the length of the "queue".
Note that we to store the length separately because the "memory" doesn't have a length that can be read.
Methods
dequeue() → {*}
Instead of removing the item from the end of the list, we're going to remove it from the start.
Returns:
- Type
- *
enqueue(value)
Push values to the end of the list.
Parameters:
| Name | Type | Description |
|---|---|---|
value |
* | Value that should be added to the list |
peek() → {*}
Getting the next value without removing it from the stack.
Returns:
- Type
- *