JavaScript Functional JavaScript Higher-Order Functions

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!


In general, functions that operate on other functions, either by taking them as arguments or by returning them (or both), are called higher-order functions.

A higher-order function is a function that can take another function as an argument. You are using higher-order functions when passing callbacks.

function iAmCallbackFunction() {
    console.log("callback has been invoked");

function iAmJustFunction(callbackFn) {
    // do some stuff ...

    // invoke the callback function.

// invoke your higher-order function with a callback function.

A higher-order function is also a function that returns another function as its result.

function iAmJustFunction() {
    // do some stuff ...

    // return a function.
    return function iAmReturnedFunction() {
        console.log("returned function has been invoked");

// invoke your higher-order function and its returned function.

Got any JavaScript Question?