Could someone please help me solve this problem?

Tell us what’s happening:
Describe your issue in detail here.

  **Your code so far**

function nextInLine(arr, 5) {
// Only change code below this line
nextInLine(arr, item) {
var removed = arr.shift();
return removed;
// Only change code above this line


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

// Display code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6));
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/90.0.4430.93 Safari/537.36.

Challenge: Stand in Line

Link to the challenge:

What do the failing tests say?

Hi @dhruvlathigara1 !

You have syntax errors because you didn’t follow instructions and added extra stuff that doesn’t need to be there.

You are not supposed to touch this part.

I would reset the lesson and make sure to only change code where you are instructed to do so.

Also, I am not sure why you wrote the function again here

that is not needed.

Hope that helps!

1 Like

Hi @dhruvlathigara1

Remember that when you are inserting arguments in this case

// First argument
var testArr = [1,2,3,4,5];
// Second argument

then you should have something like this as arguments in a function by calling the function

nextInLine(testArr, 6)

Then you will declare the function as follows with passing as “parameters” arr its your testArr and item its your number 6 no need to do any additional functions or nested functions.

function nextInLine(arr, item){


More specific just like @jwilkins.oboe has explained.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.