arr is just an arbitrary name for the array in the nextInLine method.
When console.log(nextInLine(testArray, 6)); is called, test array is passed into function nextInLine(arr, item) and can be accessed by using arr.
You can pass in testArray directly, however the testing system does not.
It will call function nextInLine(arr, item) with a unique array each time and compare the return value to an expected string.
Say you have a function add that adds two numbers.
function add (x, y) {
return x + y;
}
So that doesn’t mean “take the literal letters x and y and add them up”. That function doesn’t return xy every time you run it. That would not be a useful feature of functions (in maths or programming or anywhere that uses functions).
What it means is that when you use the function, you give it two numbers, and it returns the sum of those two numbers added together.
In the standInLine function, arr and item are just like x and y in add
Thank you! hope your day is good as well. I still don’t quite understand what the item part is refering to in the function. You say that arr is referring to var testArr = [1,2,3,4,5]. But what is item referring to.