File size: 369 Bytes
6fecfbe |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
export class Queue {
// Basic queue implementation for now
constructor(init_items=[]) {
this._queue = init_items;
}
enqueue(item) {
this._queue.push(item);
}
dequeue() {
return this._queue.shift();
}
peek() {
return this._queue[0];
}
get length() {
return this._queue.length;
}
} |