Skip to main content

Higher order functions

@serverSerrverlesskiy

Higher-order functions allow JavaScript to be suitable for functional programming. Such functions are widely used in JavaScript. If you've programmed in JavaScript even a little, you've probably used them, perhaps without even realizing it.

To fully understand this concept, you should first understand functional programming and the concept of first class functions.

What is functional programming?#

Functional programming is a branch of discrete mathematics and a programming paradigm, in which the computation process is interpreted as the calculation of the values ​​of functions in the mathematical sense of the latter (as opposed to functions as subroutines in procedural programming). [Wikipedia]

First class functions#

First_class

If you are already learning JavaScript, you may have heard that JavaScript treats functions⚙️ as first-class objects. Functions in JavaScript are objects, just like in other functional programming languages. In JavaScript, functions⚙️ are a special type of object. These are Function objects. For example:

Live Editor
Result
SyntaxError: Unexpected token (1:8)
1 : return ()
            ^

We now know what first-class functions are. You can start with higher-order functions.

Payment#

Now you are on a stripped-down version of the site, after subscribing to Patreon, you will get full access to the training course, as well as access to our server's private channels in Discord.

Download our mobile application or get tested in our JavaScript telegram bot, and also subscribe to our news.

Become a Patron!

Sumerian school

Contributors ✨#

Thanks goes to these wonderful people (emoji key):


Dmitriy K.

📖

Dmitriy Vasilev

💵

Resoner2005

🐛 🎨 🖋

Navernoss

🖋 🐛 🎨

Become a Patron!