function makeAdjectifier(adjective) {
return function(string) {
return adjective + "" + string;
};
}
var coolifier = makeAdjectifier("COOL");
console.log(coolifier("conference")); //outputs "COOLconference"
So, what I see here is coolifier function is being called and conference string is passed as an argument, and coolifier which taking input from makeAdjectifier, & cool is passed as an argument so adjective becomes cool. Now again adjectifier is returning a function which is taking string as a parameter. how conference is available at the inner function so that string becomes equal to conference.