Circular que not passing

// Trying to dequeue past the write pointer should return null and does not advance the write pointer.

it is not dequeuing past the write pointer

class CircularQueue {
  constructor(size) {

    this.queue = [];
    this.read = 0;
    this.write = 0;
    this.max = size - 1;

    while (size > 0) {
      this.queue.push(null);
      size--;
    }
  }

  print() {
    return this.queue;
  }

  enqueue(item) {
    // Only change code below this line
    let q=this.queue
    let w=this.write
    if(q[w]===null){
      let temp=q[w]
      q[w]=item
      this.write=(this.write+1)%(this.max+1)
      return temp
    }
    return null
    // Only change code above this line
  }

  dequeue() {
    // Only change code below this line
    let q=this.queue
    let r=this.read
    if(q[r]!==null){
      let temp=q[r]
      q[r]=null
      this.read=(this.read+1)%(this.max+1)
      return temp
    }
    console.log('returned null')
    return null
    // Only change code above this line  
  }
}
let q=new CircularQueue(4)
q.enqueue('a')
q.enqueue('b')
q.enqueue('c')
q.enqueue('d')
q.dequeue()
q.dequeue()
q.dequeue()
q.dequeue()
q.dequeue()
q.dequeue()
q.dequeue()

q.enqueue('e')
q.dequeue()


console.log(q.print())

it is not dequeuing past the write pointer.

ive dequeued a bunch of times past the last write and its returning null as the challenge is asking. then I enqued string ā€˜eā€™ and then dequed and its behaving as expected. if it was moving past it as its claiming its doing than it would not deque that ā€˜eā€™ because it would have advanced to a later position.

Your implementation has an issue in the enqueue code. Pay close attention to this detail in the lesson description:

In addition, the enqueue method should return the item you enqueued if it is successful; otherwise it will return null .