functional programming - Please explain me this higher-order function javascript code -


i'm studying higher order functions following eloquent javascript book. haven't been able understand code, why "boolean" passed noisy first argument?

this supposed function changes other function, don't how 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 0  // → called 0 - got false 

noisy accepts one-argument function argument. returns new function calls function, displays messages before , after calls it.

boolean example function used. converts argument boolean datatype.


Popular posts from this blog