> For the complete documentation index, see [llms.txt](https://fpjs.chatwithme.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://fpjs.chatwithme.io/types-of-functions/higher-order-function.md).

# 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.';
```
