Open monic-shixi opened 5 years ago
add = (arr) => arr.reduce((sum, value) => sum+=value, 0) function curryFactory(fn, length){ return fner = (...args) => args.length === length ? fn(args) : fner.bind(null, ...args) } curry = curryFactory(add, 5) curry(2)(2)(2)
这就是一个简单的柯里化
这就是一个简单的柯里化