I have seen in the past that you can do something like this:
function combine(arg1){
return function(arg2){
return (arg1 + arg2);
};
}
combine("foo")("bar");
And the result will be "foobar".
You can of course do something like:
(function(x){
return function(y){
return x+y;
};
})(2)(3);
With the result of 5.
I am simply wondering what this is called. I think I saw a small video of Crockford that I can't seem to find, I am sure it was on the Good Parts, that briefly talked about this. I also have the book and I can't see it in there.
It seems like just another way to invoke a function and control the scope of the variables.