I'm studying higher order functions following the Eloquent JavaScript book. I haven't been able to understand this code, why is "Boolean" passed as noisy first argument?
This is supposed to be function that changes other function, I just don't get how it works!
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