array in function parameter javascript 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: javascript function with array parameter
const args = ['test0','test1','test2'];
function call_me(param1, param2, param3){
//
}
call_me.apply(this, args);