Stand in Line (Queue to add number to end of Array and remove first element of Array)

Tell us what’s happening:

Your code so far

function nextInLine(arr, item) {
  // Your code here
  var removed=arr.shift();
  return  removed;
var removedArr=removed;
// Test Setup
nextInLine([1,2,3,4,5], 12);

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

Not sure what to do here at all and I’m totally stumped


FreeCodeCamp won’t let me post the code to the lesson since I’m new here (which is ridiculous), but it is called Stand In Line in the Javascript certification under the Introduction to Javascript section.

var removedArr=removed;

You added these lines outside of the function. removed is undefined outside of the function. Additionally, the tests are not expecting you to be adding anything to the Test Setup section.

  1. You deleted restArr, so the last three lines will cause an error.

Ok I see now, I’m obviously quite new with this but I see my errors now, thank you!