Are Execution Context and Variable Object actually same thing in JavaScript?

五迷三道 提交于 2019-12-25 04:09:55

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!