Currying is the technique of transforming a function that takes multiple arguments in such a way that it can be called as a chain of functions each with a single argument. 大概的意思就是说,将拥有多个参数的函数Currying化为拥有单一参数的函数形式。 下面举一个简单的例子说明Javascript中的Currying实现...
functionadd(...args) {if(args.length<2) {returnadd.bind(this, ...args); }const[x, y] = args;returnx + y; } Alternatively, one could write a helper function that transforms normal functions to this style. Summary# Currying is a technique for transforming functions so that they help ...