javascript function typed parameters code example
Example 1: javascript function variable arguments
function foo() {
for (var i = 0; i < arguments.length; i++) {
console.log(arguments[i]);
}
}
foo(1,2,3);
//1
//2
//3
Example 2: js use param object or multiple
Like many of the others, I often prefer passing an options object to
a function instead of passing a long list of parameters, but it
really depends on the exact context.
I use code readability as the litmus test.