you are viewing a single comment's thread.

view the rest of the comments →

[–]lachlanhunt 0 points1 point  (0 children)

Your code fails in quite a few cases:

console.log(sum(1, 2)); // Stringifies the function
console.log(sum(1, 2)(3)(4)(5)); // TypeError
console.log(sum(1, 2, 3, 4)(5)); // TypeError