问题
Title says it all.
I am so confused about whole concept of execution context in JavaScript. I understand that each execution context is associated with one variable object, and variable object stores declared variables, functions and formal parameters.
The word "execution context" is so abstract term for me to understand. If the variable object stores everything, then what is this word "execution context" for? Are these just two word for same thing?
回答1:
No, they're separate things.
All the gory details are in the spec in §10.4.3 and the sections it links to (particularly §10.5), but fundamentally an execution context has a variable binding object, but it has other things as well, like a reference to its containing context (which is what gives us the scope chain) and the value of this
within the context.
来源:https://stackoverflow.com/questions/28902895/are-execution-context-and-variable-object-actually-same-thing-in-javascript