Javascript – Is there a way to achieve currying with a local variable
We need to create a function that would print the results for: console.log(sum(1)(2)(3)(4)(5)(6)()); So this is how I did: let res = 0; function sum(a){ if(a){ res = res + a; return sum; //Return the same function for next chain…