为我从未提供的参数创建变量名的函数

A function creating variable names for parameters that I never gave

我正在从一本 eloquent 书中学习 JavaScript,在关于高阶函数的章节中我找到了这段代码:

function noisy(f) {
  return function(...args) => {
    console.log("calling with", args);
    let result = f(...args);
    console.log("called with", args, "returned", result);
    return result;
  };
}

noisy(Math.min)(3,2,1);
// calling with [3,2,1]
// called with [3,2,1] returned 1

我知道剩余参数...args接受了一些参数并将它们分组到一个数组中,但是我什么时候给箭头函数提供了任何参数?
args 是否自动包含传递给 noisy() 的所有额外参数(只需要 f)?
如果是,这种使用参数的规则是什么?
我可以只使用前两个额外参数吗?
原来的代码不应该像下面这样吗?

function noisy(f, ...args) {
    return function(args) => { // with the rest of the program

when did I gave any parameter to the arrow function

您在 noisy(Math.min)(3,2,1)(3,2,1) 部分通过了它们。 noisy() 正在返回一个函数,您随后可以使用参数 (3,2,1)

立即调用该函数

打破那个电话可能会更清楚

var myArrowFunction = noisy(Math.min)
myArrowFunction(3,2,1)