📜  理解 Currying - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:30.961000             🧑  作者: Mango

代码示例1
/**
 * The underlying base function is "add" which takes 3 arguments and return their sum.
 */
const add = (a, b, c) => a + b + c;

/**
 * We need such a function which will transform the base function such that
 * it can also process its argument one by one.
 */
const curry = (baseFunc) => {
  // TODO: Do something with it.
};

const add3 = curry(add);