The problem in your code seems to be with the way you’re handling the push operation and printing the result. Here’s a breakdown of the issues and improvements you can make:
Incorrect Console Output on Enqueue (push):
The push method in JavaScript returns the new length of the array, not the element that was pushed. So, let enter = que.push(input[i][1]) assigns the length of the queue to enter, not the element that was added.
Instead, you should directly print the element that was added to the queue.
Correcting the console.log for Enqueue:
Replace console.log(enter) with console.log(input[i][1]) to print the element being added to the queue instead of the length of the queue.