I had a question in an interview:
how to implement add(1)(2)(3).....();
Below is the case for 3 instances. But how to stretch it for more instances? The stop condition for the recursion is the function with an empty argument (IIFE)
function add(a){
return function add(b){
return function add(c){
return a+ b+ c;
}
}
}