Can not understand an algorithm
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
1 Like
could you send me a screenshot of code?