The problem of variable advance in JS scope chain

Source: Internet
Author: User
The JS access variable is from the inside out, and each activity variable above the scope chain is also from the inside out, such as a function, first the variable declared by arguments and inside the function, and then the variable that can be accessed by the outer layer, until the last window global object, when the function is out, Well done. Internally declared activity objects are destroyed, so the outer drops simply cannot access the objects declared inside the function. The reason that JS will be all the variables in advance also for different scopes, on the outermost side, is to put all global variables and global function declaration in advance, inside the function is to first declare the function inside the variables and functions in advance

The problem of variable advance in JS scope chain

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.