I don't understand why the functions are taking the outer scoped variable instead of the nearest one when called as callback.
function outerFn(){
let x = 1;
function log(){
console.log(x);
};
function run(fn){
let x = 100;
fn();
}
run(log);
};
outerFn();
I was expecting the run to log 100 instead of 1.