How does arr.push (item); know what array to push.
Is it just guessing it must be the only array in the script?
What happens if there were 2 arrays?
**Your code so far**
function nextInLine(arr, item) {
// Only change code below this line
arr.push (item);
return arr.shift();
// Only change code above this line
}
// Setup
var testArr = [1,2,3,4,5];
// Display code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6));
console.log("After: " + JSON.stringify(testArr));
**Your browser information:**
User Agent is: Mozilla/5.0 (iPhone; CPU OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) FxiOS/33.0 Mobile/15E148 Safari/605.1.15
.
Challenge: Stand in Line
Link to the challenge: