JavaScript Tutorial

Function Composition vs Currying

Function composition combines functions to create a pipeline, while currying transforms a multi-argument function into a sequence of single-argument functions.

// Composition:
const compose = (f, g) => x => f(g(x));
const add = x => y => x + y;

// Currying:
const multiply = a => b => a * b;