I am reading the book "Eloquent JavaScript".
In Chapter 5 he describes a particular higher-order function. It is called noisy()
it is printed below...
function noisy(f) {
return (...args) => {
console.log("calling with", args);
let result = f(...args);
console.log("called with", args, ", returned", result);
return result;
};
}
Here is the part that is confusing me. He calls the function noisy
as follows...
noisy(Math.min)(3,2,1);
I do not understand why the function is called that way. Why isn't it called like this...
noisy(Math.Min(3,2,1))
Edit: I see now what is going on. It was explained by Simone below.
noisy(Math.min)(3,2,1) is equivalent to (noisy(Math.min))(3,2,1).