A simple JavaScript implementation of a queue data structure using a factory function.
Methods
- enqueue(item): Adds an item to the back of the queue.
- dequeue(): Removes and returns the front item of the queue.
- front(): Returns the front item of the queue without removing it.
- isEmpty(): Checks if the queue is empty and returns a boolean.
- size(): Returns the current size of the queue.
- print(): Prints the items of the queue in the order they appear.