If you mean
function foo(x){
return function(y){
return x+y;
}
}
Then foo(5)
returns a function that takes another parameter, (y)
.
So foo(5)(6) inputs 5 to foo
, and 6 to bar
.
foo(5)(6)
returns 11
foo(4)
returns a function(y){ return 4 + y;}
foo(7)
returns a function(y){ return 7 + y;}
3
solved Javascript function with some input and output [closed]