diff --git a/javascript/09_queue/QueueBasedOnLinkedList.js b/javascript/09_queue/QueueBasedOnLinkedList.js index 75918585..a1cbe4e7 100644 --- a/javascript/09_queue/QueueBasedOnLinkedList.js +++ b/javascript/09_queue/QueueBasedOnLinkedList.js @@ -31,6 +31,9 @@ class QueueBasedOnLinkedList { if (this.head !== null) { const value = this.head.element this.head = this.head.next + if (this.head === null) { + this.tail = null + } return value } else { return -1