Stand in Line -stuck

Tell us what’s happening:

I got all the answers exept the last where i got 1, and 10
Instead of 10

Your code so far


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


var testArr = [1,2,3,4,5];



console.log(nextInLine([5,6,7,8,9],1));
console.log (nextInLine([],5));
console.log (nextInLine([],1));
console.log(nextInLine([2] ,1));
console.log( nextInLine(testArr,10 ), testArr[4]);

Your browser information:

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

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

Why did you put item inside of an array?

1 Like