Functional

JavaScript logo

Programs that are terse, yet easy to reason about. Programs that don't reinvent the wheel at every turn.

@drboolean

Why?

How?

Functions as values

const fetchDogs = (fetcher, name) => fetcher(name);
const fetchDogsCreator = (fetcher) => (name) => fetcher(name);
const fetchPups = fetchDogsCreator(pupsApiFetcher);
fetchPups('Harold');

Composition

const dogSaloon = (name) => trimDogs(addDogs(getDogs(name)))
const dogSaloon = (name) => getDogs | addDogs | trimDogs
const dogSaloon = pipe(getDogs, addDogs, trimDogs)

Pure functions & immutability

Applying category theory on everything

Please let me code

Array.map, Array.filter, Array.reduce
Array.flat, Array.some, Array.every, Array.slice, Array.concat

Conclusion