I'm a little confused about the timing when a Function gets its closures. Does that happends during the compile time or runtime. It would be better to explain that concept with the execuation context.
Do all Functions born with the internal property [[scopes]]. If so, what is the relationship between [[scopes]] and the "reference to the outer lexical environment". Who determines the scopes chain?
The following code can be used as an example:
function a(){
let t = 0;
return function b() {
t++
console.log(t);
}
}
let c = a();
c();
I'm trying to fully understand the relationship between execuation context, execuation stack, lexical environment, closure, [[scope]].