Stand in Line Section

Stand in Line Section
0

#1

Can someone explain this a little more with me? The below code is what i wrote and it passed but one of the items it says is suppose to come back is a 5. But i dont have a 5 in this list anywhere so hows it still passing?

function nextInLine(arr, item) {
// Your code here
arr.push(item);
var popValue = arr.shift();
return popValue; // Change this line
}

// Test Setup
var testArr = [6,7,8,9,10];

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 11)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));


#2

This is the result. This is from the javascript section:
Before: [6,7,8,9,10]
6
After: [7,8,9,10,11]

I know arr.push() will add an item to the end of the array and arr.shift is getting the first item in the list but as per the summary of what they say is suppose to come back it dont match up unless im reading it wrong.

Whats suppose to be checked off if it passes.
nextInLine([], 1) should return 1
nextInLine([2], 1) should return 2
nextInLine([5,6,7,8,9], 1) should return 5
After nextInLine(testArr, 10), testArr[4] should be 10


#3

Think i figured out why is correct even though technically it isnt. When i ran it the first time it saw that part of it was correct so it checked the answer and when i changed it around it just checked the rest of the answer that wasnt checked off yet and didnt touch the ones that were already checked off…

If that makes any sense.