I've already read :
What is the difference and relationship between execution context and lexical environment?
Lexical environment and function scope
https://262.ecma-international.org/6.0/#sec-lexical-environments
https://262.ecma-international.org/6.0/#sec-execution-contexts and more...
Just want to clarify one final time for myself. What is the actual difference between Lexical Environment vs Execution Context?
Am I right that they're absolutely the same thing, but Execution Context is actually one of Lexical Environments in our code that is currently on the top of our callstack??
So let's say we have
1 function one() {
2 return
3 }
4
5 function two() {
6 one()
7 }
8
9 two()
First we have out global context in the stack, it's currently our Execution Context. Browser starts running our code, goes down to line 9 and put function two()
on the top of the call stack. So now our Execution Context is the Lexical Environment of this function.
Is that correct or am I missing smth?
Thanks for help!