+ 1

Explain the Output

function foo(call){ return function(city){ console.log(call()+" from "+ city); } } function friend(){ return 'i call you back'; } foo(friend)('rajasthan'); In the above program when i write console.log instead of return inside the friend function the output is different says undefined why? Anyone explain this.

4th Aug 2020, 1:24 AM
Samir Singh
Samir Singh - avatar
1 Answer