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.


#2

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


#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?


#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 (


#5

Have a look at the code you posted :slightly_smiling_face:


#6

:face_with_hand_over_mouth:


#7

Thank you. I lost my eyes


#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.


#9

thanks for your help its has been solved