Higher-Order Function

noun

say it: “HY-er OR-der FUNK-shun” /ˈhaɪər ˈɔːrdər ˈfʌŋkʃən/ or “HY-er OR-der FUNGK-shun” /ˈhaɪər ˈɔːrdər ˈfʌŋkʃən/

A function that takes another function as an input or hands one back as its result, such as map, filter or a function that builds counters.

What is Higher-Order Function in JavaScript?

Higher-Order Function — A function that takes or returns another function.

function applyDiscount(price, discount) {
    return discount(price);
}

In a sentence

  • “filter() is a higher-order function: I hand it a function that decides which pets to keep.”
  • “filter is a higher-order function: I hand it a small function that says which songs to keep.”

Level: Journeyman · More JavaScript terms at this level

Updated

In other subjects