DEV Community

Discussion on: Stacks and Queues

Collapse
 
elishaking profile image
King Elisha

Unfortunately, there is no out-of-the-box solution in JS - that I know of - to remove an item from the beginning of an array in constant time.

Although the items property is not modified by dequeue, the startPos property is. So we can say that the queue always begins from startPos

Collapse
 
gauravrawat440 profile image
Gaurav Singh Rawat

yeah, hope so something will come up in future. But this does job pretty