Higher Order Function

As seen in the talk https://www.youtube.com/watch?v=e-5obm1G_FY I found this js snippet a nice introduction to higher order functions which is common in functional programming.

function makeAdjectifier(adjective) {
    return function (string) {
        return adjective + " " + string;
    }
}
var coolifier = makeAdjectifier("cool");
var sample = coolifier("function");
console.log(sample); //cool conference

Add your comment