Stand in Line help please

Tell us what’s happening:

Im am not really understanding this lesson here. Could someone help?

Your code so far


function nextInLine(arr, item) {
  // Your code here
  testArr.push(item);

  return testArr.shift();  // Change this line
}

// Test Setup
var testArr = [5,6,7,8,9];

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 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; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36.

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

Your solution is not using one of the function parameters. The function has no idea what testArr is, because testArr is just an array FCC is providing to allow you to check the function works.

So are you saying I shouldn’t be using testArr inside my function?

Im using the parameter “item”.

I figured it out right in my face lol thanks!

1 Like