function nextInLine(arr, item) {
// Your code here
arr.push(item);
var removed = arr.shift(item);
return removed; // Change this line
}
// Test Setup
var testArr = [1,2,3,4,5];
// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));`
it says that the value will be "before = [1,2,3,4,5] and after = [2,3,4,5,6] " why it is not [2,3,4,5,1]?
push takes the first item and add it to the back why they put 6 instead of 1 ?