Home  >  Article  >  Web Front-end  >  Miscellaneous talk about execution environment in javascript_javascript skills

Miscellaneous talk about execution environment in javascript_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:03:33954browse

——This starts with the JAVASCRIPT interpreter: Whenever the JAVASCRIPT interpreter starts to execute a function, it will create an execution environment and generate a variable object closely related to the function. In this execution environment All variables or functions defined in will be saved by him. But he is like a relevant department, which may be closely related to you, but you will never find him. You cannot call this object, but the JAVASCRIPT parser will call it when processing data.
That’s it for the topic. Let’s talk about the execution environment in real terms. Let's start with the global execution environment. It is the outermost of the entire execution environment and is added as an attribute of the window object.
For example:

Copy code The code is as follows:









The chestnut above will eventually pop up true. In other words, the global variables we defined at the outermost periphery are eventually integrated into the window. Whenever all the code in an execution environment is executed, the definitions of variables and functions in it will be downloaded and destroyed. Those who eat fruit will die like a dog.
But what I have to say is that the implementation of Javascript allows multiple global execution objects. Nani? ! Yes, let’s use a bad example: IFRAME. The owner in IFRAME is different from the global environment of the browsing window. Of course, if cross-domain attribute acquisition is involved, then security is a concern. Well, that's it. That’s all
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn