6 fundamental terms in functional JavaScript

Martin Novak
Frontend Weekly
Published in
4 min readJan 27, 2018

--

Do you even lambda, bro?

Let’s talk about what are lambdas, first-class functions, higher-order functions, unary functions, currying and pure functions.

If you are not clear on the difference between imperative and declarative programming, please consider reading my post: Imperative vs Declarative programming in JavaScript

What is a lambda => arrow function?

Lambdas (λ) are better known in JavaScript as arrow functions:

// this is your regular named function in JavaScript
function namedFunction (a, b) {
return a + b;
}
// this is a lambda, i.e. an arrow function
const lambda = (a, b) => a + b;

The term lambda originates from lambda calculus, a formal system of mathematical logic. Lambda calculus is of course Turing complete and as such it represents a universal model of computation able to build any Turing machine.

Lambda expressions are the cornerstone of functional programming. If it helps you, just think of them as a new shorter syntax for your functions. However, be careful about using them in your objects or classes as they use lexical this.

What is a first-class function?

--

--

Martin Novak
Frontend Weekly

Martin is a product manager at work, a software developer in his free time, and an entrepreneur at heart.