class Queue {
constructor(){
this.storage = [];
}
//enqueue item
enqueue(value) {
this.storage.push(value);
}
//dequeue item
dequeue() {
if (this.storage.length === 0){
//queue is empty
return false;
}
return this.storage.shift();
}
//check queue length
length() {
return this.storage.length;
}
//print queue
print() {
return this.storage;
}
}
//create Queue
myQueue = new Queue;
myQueue.enqueue('this');
myQueue.enqueue('is');
myQueue.enqueue('my');
myQueue.enqueue('test');
myQueue.enqueue('queue');