Reputation: 171
f2=function(fn){
return fn
};
f1 = f2(function(a,b){
console.log('' + a+ b)
});
f1(3,4);
output is 34
Why are the parameters(3 and 4) passed to f3?
Upvotes: 0
Views: 26
Reputation: 1
Why are the parameters(3 and 4) passed to f3?
The function returned from f1
f2(function(a,b){
console.log('' + a+ b)
});
is invoked ()
with 3
, 4
passed as parameters f1(3,4);
, where a
is 3
, b
is 4
Upvotes: 1