I have a simple demo:
function add(a) {
return function (b) {
return a + b
}
}
Now when I call add(1)(2) it will give me 3
but I want something like this:
add(1)(2)(3) -> 6
add(1)(2)(3)(4) -> 10
it means I can add more function if I want. How to write it?
for each