How do iteration methods identify parameters?

When studying iteration methods, I did not understand how these methods “understand” parameters passed. How does a method identify the passed parameter as an accumulator? Is it a pre-defined function or value?
Also, if I pass a parameter called ‘currentValue’, how does the method know it is referring to the element of the array?
For example, here:
png
how does reduce() know that the first parameter ‘accumulator’ has to be increased while the ‘currentValue’ refers to the element?

Hi @course7696103059
Welcome to the forum!

Not a method – but this particular method .reduce(): MDN docs: Array.prototype.reduce()

The arguments the array methods accept are predefined.

Not sure what you mean exactly, if you are still talking about array methods, the order of the parameters/arguments make clear which function the argument has.
Inside the function/method body, you address them by the parameter’s name.

Oh! I got it now!
So there are predefined arguments, and reduce() identifies ‘accumulator’ in particular. And the order of parameters first matter. Am I right?

Yes, in the .reduce() method, the first parameter is identified as the accumulator, the second as the current value. What you do with the current value depends on your function. You could return a sum or a product or anything else. In any case, the reduce() method is supposed to turn an array into a single value.
As for the order of parameters: Take .slice() for example: The first argument is mandatory, the second optional. If you just pass one argument, it will always be taken as the start value.

But just to clarify for the .reduce() method: This method does not take the accumulator and current value as arguments: It takes a callback function as an argument. And that callback’s parameters are accumulator and current value.