Queues Using Stacks
class Queue{
constructor(){
this.front = 0;
this.rear = 0;
this.length = 0;
this.stack = [];
this.revstack = [];
}
enqueue(value)
{
this.stack[this.rear]= value;
this.rear++;
}
dequeue(){
if(this.front>this.rear)
console.log('empty');
let value = this.stack.splice(this.front,1);
this.front++;
return value;
}
}INFO