send arguments es6 code example
Example 1: javascript multiply arguments
const mul = (...args) => args.reduce((a, b) => a * b);
// Example
mul(1, 2, 3, 4); // 24
Example 2: 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