While coding, i faced a problem in resolving variables in a code similar to the code below:
function foo(callback) {
callback();
}
foo( function(parameter) {
// how variables are resolved here? what is the outer scope?
console.log('helloWorld');
});
The questions are:
how variables are resolved inside the anonymous function defined in foo parameters spot?
I know that javascript resolve variables using the lexical scope, but in that function, what is the outer scope ?