mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 08:57:08 +00:00
23 lines
236 B
JavaScript
23 lines
236 B
JavaScript
|
|
class Queue {
|
|
|
|
constructor (items = []) {
|
|
this.items = items;
|
|
}
|
|
|
|
enqueue (item) {
|
|
this.items.push(item);
|
|
}
|
|
|
|
dequeue () {
|
|
return this.items.shift();
|
|
}
|
|
|
|
length () {
|
|
return this.items.length;
|
|
}
|
|
|
|
}
|
|
|
|
module.exports = Queue;
|