Implementing Stacks & Queues
What unique capability does this Deque implementation provide?
class Deque {
constructor() {
this.items = {};
this.front = 0;
this.rear = 0;
}
addFront(element) {
this.front--;
this.items[this.front] = element;
}
addRear(element) {
this.items[this.rear] = element;
this.rear++;
}
}