0

I am very new at JS and coding. please forgive my ignorance. i am trying to figure out the following piece of code. how does the argument(3,2,1) get assigned to the input to the arrow function? I do not see any explicit assignment.

function noisy(f) {
  return (...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);
Heretic Monkey
  • 11,687
  • 7
  • 53
  • 122
  • 1
    `noisy` returns a function expecting `...args`. You then call that function with the parameters 3, 2, 1 thereby "assigning" to the parameter. – luk2302 Sep 25 '22 at 17:23
  • [How does function evaluation work in Javascript?](https://stackoverflow.com/q/30229331) | [Explain "you can have functions that change other functions"](https://stackoverflow.com/q/31622584) | [Higher-order functions in Javascript](https://stackoverflow.com/q/23535316) | [Eloquent JavaScript:](https://stackoverflow.com/q/34552880) | [How is this statement a Boolean](https://stackoverflow.com/q/41948299) | [Can someone explain this higher-order JavaScript function confusing syntax?](https://stackoverflow.com/q/50003830) – VLAZ Sep 25 '22 at 17:27

0 Answers0