function add(a){ return function (b){ if(b) return add(a+b) return a } } console.log(add(3)(9)(2)(4)(1)())