function nextInLine(arr, item) {
// Your code here
item = 1;
testArr.push(item);
var removedElement = testArr.shift();
return removedElement; // 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));
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:62.0) Gecko/20100101 Firefox/62.0.
You’re putting 1 on the end of the array every time, regardless of what item actually is. So if I do nextInLine([1,2,3], 4) you’re going to ignore that 4 and use the number 1 instead, which is incorrect