Miscellaneous about execution environment in javascript

Source: Internet
Author: User

-- This starts with the JAVASCRIPT interpreter: every time the JAVASCRIPT interpreter starts to execute a function, it creates an execution environment, in addition, a variable object that is closely related to this function will be generated, and all variables or functions defined in this execution environment will be saved by it. But he is like a related department and may be closely related to you, but you can never find him, and you cannot call this object, however, the JAVASCRIPT parser calls it when processing data.
So far, let's talk about the execution environment. Starting from the global execution environment, it is in the outermost area of the entire execution environment and is added as a property of the window object.
For example:
Copy codeThe Code is as follows:
<Html>
<Head>
<Script type = "text/javascript">
Var a = 1;
(Function (){
Alert (window. a === );
})();
</Script>
</Head>
<Body>
</Body>
</Html>

True is displayed at the end of this example. That is to say, the global variables we define at the periphery are finally compiled into windows. After all the code in an execution environment is executed, all the variables and function definitions in the environment will be taken down and destroyed. The rabbit who eats the fruit.
However, Javascript allows multiple global execution objects. Nana ?! Yes, it's a bad chestnut: IFRAME, the owner of IFRAME is different from the global environment of the window. Of course, if cross-origin attribute retrieval is involved here, we need to talk about security. Well, Click till now. That's all.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.