Functional Programming: Higher Order Functions

Shahzad Khan
Level Up Coding
Published in
9 min readJul 24, 2020

--

A Better Take on JavaScript’s Higher Order Functions.

Functional Programming is awesome! It makes programming fun.

Learning to program “functionally” is going to make you a fantastic programmer and you will feel secure with the quality of your work.

You will be able to write your programs with fewer bugs and in less time because you will be able to re-use your code.

Within this paradigm, we will focus on one of the most important concepts in functional programming, and that is Higher-Order Functions.

So let’s get started!

In JavaScript, and in many functional programming languages, functions are values.

Let’s take a simple function for example:

function double(x) {
return x * 2
}

What is super cool about JavaScript is that we can take this function and make it into an anonymous function to pass it around and re-use it by declaring a variable.

let double = function(x) {
return x * 2
}
let pancake = double

--

--