Higher-Order Function

A function that returns a function and or accepts a function as an input parameter.

A function that returns a function

const fn = () => 'returning function value.';

const higherOrderFunction = () => fn;

A function that accepts a function as an input parameter

const fn = () => 'returning function value.';

const higherOrderFunction = (fn) => {};

A function that accepts a function as an input parameter and also returns a function

const fn = () => 'returning function value.';

const higherOrderFunction = (fn) => () => 'another returned function value.';

Last updated

Was this helpful?