Linked List Implementation
There is another way to implement a queue. This is very similar to the Linked List implementation of stacks we used in a previous lesson.

xxxxxxxxxx55
queue.Dequeue();class Node { constructor(key) { this.Data = key; this.Next = null; }}​class Queue { constructor() { this.front = null; this.rear = null; }​ Enqueue(key) { let node = new Node(key);​ if (this.rear === null) { this.front = node; this.rear = node; return; }​ this.rear.Next = node; this.rear = node; }​ Dequeue() { if (this.front === null) { return;OUTPUT
:001 > Cmd/Ctrl-Enter to run, Cmd/Ctrl-/ to comment

