i do understand that due to lexical scoping, block scopes can access the enclosing scope variables. But what i do not understand is how it really works. ex:
function first(){
let i=10;
function second(){
let j=20;
console.log(i);
if(j==20){
console.log(i);
}
}
second();
}
the first console.log() get the value of i after its looks up the scope chain in the variable object. But how does the console.log() inside the block get access to variable i as it does not create an execution context and thus no scope chain.