If a function takes a function as a parameter (such as a callback function), then this function is a higher-order function. If a function’s return value is a function (such as a closure), then this function is a higher-order function.
Callback Function
1 2 3 4 5 6 7
functionfn(callback) { callback && callback(); }
fn(function() { ... });
Closure
A function that can access the local variables of another function is called a closure.
The main purpose of a closure is to extend the scope of local variables.