We will be creating a module that helps us generate a Queue Class in the Node environment. A queue is a data structure in which the first element is inserted from one end called REAR (also called tail), and the deletion of existing element takes place from the other end called as FRONT (also called head). This makes queue a FIFO (first in first out), or the element that is inserted first will always be the first to be removed.
Returns the size of the queue
Adds an item to the top of the queue structure
Takes an item off the top of the queue and returns the item.
Returns the first item in line to be removed without removing it. If there are no items in the queue, return null
- Fork this repository and clone it from your personal GitHub Account
- In the Terminal, navigate to the newly created folder for this repository.
- Install dependencies by running the command:
npm install
- Run tests by running the command:
npm test
- Your work will be one in the file named:
lib/Queue.js
- Make your tests pass!