### return sum of 1,2,3 upto n number in js [duplicate]

Someone ask me an question to write an closure function which should return the sum of input provided and input can be one argument upto n. so user can call sum(5) OR sum(4)(3) OR sum(1)(2)…(n), I wrote the below function using recursion but facing an issue where I need to add an empty parentheses at…

Details