"Stand in Line" Advice

"Stand in Line" Advice
0

#1

For everyone who’s having a hard time understanding this challenge…here’s my explanation.

console.log(nextInLine(testArr, 6));

As a learner it is very important to understand the line of code above!!!
What this line does is…
a) it uses the function nextInLine
b) it manipulates arguments testArr and 6
c) it goes back to the function above named nextInLine(arr, item){}
then it completes the following steps
arr.push(item); -----> adds 6 to the array
var removed = arr.shift(); -----> removes the first element of the array testArr = [1,2,3,4,5];
then it stores all elements of the array in VAR REMOVED and prints out [2,3,4,5,6]

nothing too complicated really but I personally found the wording a bit confusing.
So I hope this helps!