In Chapter 5 of the book Eloquent JavaScript, there's this example that I don't quite understand. It's the noisy function:
function noisy(f) {
return function(arg) {
console.log("calling with", arg);
var val = f(arg);
console.log("called with", arg, "- got", val);
return val;
};
}
noisy(Boolean)(0);
// → calling with 0
// → called with 0 - got false
When noisy is called, it has two arguments (Boolean)(0). How does that work? Can you call functions and place arguments in that manner? Any help is greatly appreciated, thanks!