Higher-order functions operate on other functions
Case 1: It takes functions as arguments
function fn (callback){
callback&&callback();
}
fn (function (){ alert('li')})
Copy the code
Case 2: The return value is a function
function fn (callback){
return function(){}
}
fu();
Copy the code
Conclusion: Both cases can be called higher-order functions