Stand in Line false fail or?

Stand in Line false fail or?
0

Tell us what’s happening:
When I run the test, my code apparantly fail on;

`nextInLine([], 1)` should return  `1`
`nextInLine([2], 1)` should return  `2`
`nextInLine([5,6,7,8,9], 1)` should return  `5`

but when I look in the developer console in Chrome, it looks like the requirements are met. This is what the console shows, with the code provided i the Your code so far section;

Before: [5,6,7,8,9]
5
After: [6,7,8,9,1]

Is it a bug in the lesson? Or does anyone have a clue to what I’m missing?

Your code so far


function nextInLine(arr, item) {
  // Your code here
  testArr.push(item);
  return testArr.shift();
}

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

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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/stand-in-line/

Hello @sshn :grinning:

please replace testArr in nextLine function with arr because nextLine function has arr as parameter.

Test your code.

arrg… That was so obvious, can’t believe I missed it… Thanks dev-313