SOURCE

let currying = (fn, ...args) =>
    fn.length > args.length ? 
    (...arguments) => currying(fn, ...args, ...arguments) : 
    fn(...args);


let addSum = (a, b, c) => a+b+c
let add = currying(addSum)
console.log(add(1)(2)(3))
console.log(add(1, 2)(3))
console.log(add(1,2,3))
console 命令行工具 X clear

                    
>
console