Stand in Line please help thanks

Tell us what’s happening:

Your code so far

function nextInLine(arr, item) {
  testArr.push(2);// Ytour code here
   var removed = testArr.shift();
  return item;  // Change this line

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

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine([2],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; rv:65.0) Gecko/20100101 Firefox/65.0.

Link to the challenge:

Based on your current code, you do not seem to understand what your function is supposed to return. Currently, you are returning the same value (item which is 1) that is passed to the function.

Using your function with the example test case provided in the challenge var testArr = [1,2,3,4,5]

You call the function sending two parameters - nextInLine(testArr, 6)

function nextInLine(arr, item) {  //  ( arr is [1,2,3,4,5] , item is 6 )
   testArr.push(2);// you are pushing a 2, you want to push the parameter passed which will not always be 2
   var removed = testArr.shift();  //you are correctly removing the first element (the 1) and saving it in a variable 
   return item;  // but you are not returning that removed element here though