Stand in Line - Arguments/Parameters naming convention

Tell us what’s happening:
I did pass the test on this section but I don’t understand the naming convention of the arguments.
Are these “keywords”? (arr, item) Is there a list of argument keywords somewhere?
The array variable was named “testArr”.
Does “arr” refer to the closest array?

I guess “item” is referring to a value in the array. I get that.

Thanks in advance.

Your code so far

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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36.

Challenge: Stand in Line

Link to the challenge:

@DartnDav Welcome to the forum!

You might benefit from reviewing this challenge.

parameters can be named freely, like any variable, there are no special keywords here
they take the value of what is passed in, in your case near the bottom of the page here:

So the reference was coming out of the console log. I thought console log was only for output to the console not for reference. Thanks.

The function was never called in the SIL exercise. Just the Console.log. I guess that was confusing me also. Thanks.

The function most certainly was called. It just happens the function call is also inside the console.log statement.

1 Like

Whatever the function that runs inside console.log() returns will be printed. That being some explicit return value, or undefined which is the default return value for functions that do not have a return and what console.log() always returns.

function noReturn() {
  const doNothing = 'I do nothing'

// undefined
// undefined

Thanks. I did not know that was a capability of the console.log.

console.log will print anything you put in it to the console
functions can be called anywhere, and their returned value is used in their place, in this case it is called inside the console log and the returned value is printed to the console

1 Like