3
How do I do a Javascript function that can receive a quantity infinite parameter?
When I refer to infinite, I am aware that there is a limit, but I want to do a function where the person can pass as many parameters as he wants: one, two, five, ten, and do the same thing for each parameter passed to him.
A simple example would be something like:
function multiplicar(n1, n2, n3, n4) {
return n1*n2*n3*n4;
}
Only instead of accepting 4 parameters, accept a quantity of 2 to as many as the person puts (given the limit supported by the language)
As a bonus question, if you know, what is the limit of parameters that a function can receive in Javascript?
Related: What is the '...' operator for in Javascript?
– Woss
Related: What improvements will the Spread Operator implementation bring to javascript?
– Woss
Related: There is a design standard or recommendation that defines the optimal amount of parameters a function should have?
– Woss