Files
30-seconds-of-code/snippets/binary.md
Isabelle Viktoria Maciohsek 2b6f2b1740 Update snippet descriptions & tags
2020-10-18 23:04:45 +03:00

17 lines
327 B
Markdown

---
title: binary
tags: function,intermediate
---
Creates a function that accepts up to two arguments, ignoring any additional arguments.
- Call the provided function, `fn`, with the first two arguments given.
```js
const binary = fn => (a, b) => fn(a, b);
```
```js
['2', '1', '0'].map(binary(Math.max)); // [2, 1, 2]
```