function __matchArgs__(fn) {
return function (...args) {
console.log(args)
if (args.length !== fn.length) {
throw RangeError("Arguments not match!");
}
return fn.apply(this, args);
}
}
var add = __matchArgs__((a, b, c) => a + b + c);
console.log(add(1, 2, 3));
I would like to ask return function (. ARGs)
shouldn"t the arg here be the formal argument of the function _ _ matchArgs__? Why does log come out as a formal parameter in fn?