Are you already using them?
Though the term higher-order may sound fancy and complicated, it is actually much simpler than you’d think. In fact, you have probably already used higher-order functions without even realizing it.
A higher-order function
is a function that either takes a function or functions in as an argument or returns a function. All other types of functions are considered first-order functions
. Because JavaScript accepts higher-order functions, that is what makes this programming language suitable for functional programming.
To better understand this concept, you first need to know a bit about functional programming and first class functions
. Functional programming is a paradigm where you build applications with functions, as the name implies. This is accomplished with the use of pure functions, recursion and avoiding side-effects, mutable data, and shared state. If you want a more thorough explanation on functional programming, you can read my post about it here.
#javascript #functional-programming #higher-order-function