freeCodeCamp Challenge Guide: Stand In Line - Help

freeCodeCamp Challenge Guide: Stand In Line - Help
0
#1

It is working code:

function nextInLine(arr, item) {
// Your code here
arr.push (item);
var removedItem = arr.shift();
return removedItem;
// 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));

But I don’t understand, how function take value testArr ?
I don’t understand, how testArr relate to nextInLine if it don’t have mention.

0 Likes

#2

Not sure what you mean, you pass testArr to the function: nextInLine(testArr, 6)

0 Likes

#3

I could not do it, I looked at the decision in the “Get a hint”. And I try understand it. Where function take value array?
In testArr? How testArr relate to nextInLine?

0 Likes

#4

you pass testArr to the function: nextInLine(testArr, 6) - Sorry, maybe this is a stupid question but I can’t find it in code (

0 Likes

#5

Have a look at the code you posted :slightly_smiling_face:

0 Likes

#6

:face_with_hand_over_mouth:

0 Likes

#7

Thank you. I lost my eyes

1 Like

#8

It’s a test value set for the function. which works in the console section.
console.log(nextInLine(testArr, 6)); // Modify this line to test

testArr takes the array values for this first param and value 6 for second param.

You can change the values.

0 Likes

#9

thanks for your help its has been solved

0 Likes