Array.prototype.unshiftintermediateconst queue = ['second', 'third']
queue.unshift('first')
queue.shift() // β 'first' (FIFO)Use unshift() with shift() to manage a FIFO queue by adding to the front and removing from it.
Using unshift to prepend and pop to dequeue from the end gives you a simple FIFO queue.
Implement enqueue which prepends val using unshift and returns the modified queue.