Function composition is the process of combining two or more functions to produce a new function. Composing functions together is like snapping together a series of pipes for our data to flow through.

const trim = (s: string) => s.trim();
const capitalize = (s: string) => s.toUpperCase();

This post is also available on DEV.