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]