JS Stand in line

JS Stand in line
0

#1

Can not understand an algorithm


#2
nextInLine([5,6,7,8,9], 1) // should return 5
  • add the number to the end of the array:
[5,6,7,8,9] <====== 1 // now you have [5,6,7,8,9,1]
  • then remove the first element of the array:
5 <==== [6,7,8,9,1]
  • return removed element"
5

#3

could you send me a screenshot of code?