Stand in Line i did not get this

Tell us what’s happening:

Your code so far

function nextInLine(arr, item) {
  // Your code here
  
  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(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36.

Link to the challenge:

Your function has to do these things:

  • Append item to the arr array.
  • Remove the first item from the array.
  • Return that item.

Suppose the input array is [1,2,3,4,5] and item is 6, the function’s return value should be 1 (the first item). And the input array should now be [2,3,4,5,6] after that.

2 Likes

thank you.now i understood…

I am stuck with this problem, i cant understood what is the scenario, can you give the example of it… how to write the code here.