Files
30-seconds-of-code/snippets/binary.md
Isabelle Viktoria Maciohsek 27c168ce55 Bake date into snippets
2021-06-13 13:55:00 +03:00

403 B

title, tags, firstSeen, lastUpdated
title tags firstSeen lastUpdated
binary function,intermediate 2020-05-13T13:36:36+03:00 2020-10-18T23:04:45+03:00

Creates a function that accepts up to two arguments, ignoring any additional arguments.

  • Call the provided function, fn, with the first two arguments given.
const binary = fn => (a, b) => fn(a, b);
['2', '1', '0'].map(binary(Math.max)); // [2, 1, 2]