I need to add the function n number of arguments. Example : add(3)(8)(6)(10).
if it is only 2 arguments we can add the code like this. add(4)(5)
function add(x){
return function(y){
return x+y;
}
}
add(4)(5)
if it is n number of arguments of how can we do this?
add(3)(8)(6)(10) === 27, for any number of terms? That’s impossible. You can have something that acts like a number, but it won’t really be one (and that would be a terrible API).na priori?