How do I make a JavaScript function that can receive an infinite amount of parameters?
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 same thing for each parameter passed to it.
A simple example would look something like:
function multiplicar(n1, n2, n3, n4) {
return n1*n2*n3*n4;
}
But instead of accepting 4 parameters, accept an amount of 2 as many as the person puts (given the limit supported by the language)
As a bonus question, if so, what would be the limit of parameters that a function can receive in JavaScript?