Stand in Line challange

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

I am unable to understand this problem well enough. hence not able to find a workable solution either.
Please help.

Here is the function I wrote:

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

All right!
Here is what I made it now:

function nextInLine(arr, item) {
 
  var toBeRet=arr[0];
  arr.push(item);
  arr.shift();
  return toBeRet;  /
}

This problem says β€œthe nextInLine function should then return the element that was removed.”
But after running tests, error asks to return the values which were added:

nextInLine(, 5) should return a number.
nextInLine(, 1) should return 1

OKAY!!!
Thanks for guiding through it. :smiley: