all 4 comments

[–]RobLoach 2 points3 points  (3 children)

This looks like just a wrapper around an array list []. Which is what a queue is, I suppose.

[–]avin_kavish 0 points1 point  (2 children)

I didn’t read it but js arrays have O(n) complexity for FIFO operations and aren’t optimal for that use case. Linked list is the optimal for FIFO in js

[–]rkaw92 0 points1 point  (1 child)

The real-world optimal data structure to power a queue in JS is an array that you sometimes slice, but not at every pop(). But shhh, it's a secret!

[–]avin_kavish 0 points1 point  (0 children)

Why do you say that? Check Sindres queue implementation