JavaScript Algorithm: Stand in Line
We will write a function that is based on a computer science concept called a queue where we add and remove items to and from an array.
We are going to write a function called nextInLine
that will take an array (arr
) and an integer (item
) as arguments.