Some arguments seem not to be accessible in function

Some arguments seem not to be accessible in function
0.0 0


I’m stuck on Seek and Destroy: I can’t see how to access the parameters after the first one. If I add no code other than a console.log(arr); I only see the array, not the 2nd & 3rd parameters. I.e.

function destroyer(arr) {
  // Remove all the values 
  console.log(arr);  // just shows [1, 2, 3, 1, 2, 3]
  return arr;
destroyer([1, 2, 3, 1, 2, 3], 4, 5);

What happens to the 4, 5? I need them in the function to know what to remove, but can’t see them.


All arguments passed to a function are stored in the arguments array. See


when you have more arguments than parameters … like in your case here you have the arguments method.
so if you console.log(arguments) you get array of all of them … if you console.log(arguments[1]) you get [4,5]


Ah, thanks, I was trying arr[1], based on the MDN description, where I read ‘argument’ as referring to whatever name the argument had, instead of literally argument.

Thanks both of you.