Spot the bug in the linked queue

from Arrays and linked lists
Node 24 intermediate 6 min 2 issues to find

Find the boundary bugs in this generated linked queue.

JavaScript
class Queue {
  constructor() {
    this.head = null;
    this.tail = null;
    this.size = 0;
  }
  enqueue(value) {
    const node = { value, next: null };
    if (this.tail) this.tail.next = node;
    else this.head = node;
    this.tail = node;
    this.size += 1;
  }
  dequeue() {
    const value = this.head.value;
    this.head = this.head.next;
    this.size -= 1;
    return value;
  }
}
Open in playground
Report an error