Creating the Queue class
We are going to create our own class to represent a queue. The source code for this chapter is available inside the src/05-queue-deque
folder on GitHub. We will start by creating the queue.js
file which will contain our class that represents a stack using an array-based approach.
In this book, we will take an incremental approach to building our understanding of data structures. We will leverage the concepts we mastered in the previous chapter and gradually increase the complexity as we progress (so make sure you do not skip chapters). This approach will allow us to build a solid foundation and tackle more intricate structures with confidence.
First, we will declare our Queue
 class:
class Queue {
#items = [];
// other methods
}
We need a data structure that will store the elements of the queue. We can use an array to do this as we are already familiar with the array data structure, and we have also learned in the previous chapter that an...