Jabascript arrguments

Tell us what’s happening:
Describe your issue in detail here.
Can you please tell me how does the ‘arr’, and ‘item’ arrguments know that ‘arr’ arrgument from the function is acctualy the array , in this case 'testArr=[1,2,3,4,5]; and how does the javascript know that ‘item’ that has been ‘pushed’ is to be 6;

  **Your code so far**

function nextInLine(arr, item) {
// Only change code below this line
return arr.shift();
// 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/91.0.4472.124 Safari/537.36 Edg/91.0.864.64

Challenge: Stand in Line

Link to the challenge:

console.log(nextInLine(testArr, 6));

The function nextInLine is being called with the argument testArr, which is [1,2,3,4,5], and the argument 6.

If I do this:

function showNum(num) {
  console.log('num is', num);

// num is 5

// num is 127

Does that make sense?

Yes, thank you guys very much:)

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