JavaScript: Parameters
When coming from the Java world one has to get used to functions in JavaScript, where appropriate, can take any number of parameters. This is because it’s a language feature (MDN).
Recently I noticed this using the push function of the array type.
So you can replace the following three lines :
var numbers = [];
numbers.push(1);
numbers.push(2);
numbers.push(3);
simply with this:
var numbers = [];
numbers.push(1, 2, 3);