Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Sorting out the basic knowledge points of JS

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains "the arrangement of basic knowledge points of JS". Friends who are interested may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "the basic knowledge of JS collation" bar!

1. Execution environment

Sometimes called environment, it is one of the most important concepts in JavaScript. The execution environment defines other data that variables or functions have access to.

2. Variable object

Each execution environment has a variable object associated with it, and all variables and functions defined in the environment are stored in this object.

3. Domain chain

When the code is executed in the environment, the scope chain of the variable object is created to ensure orderly access to all variables and functions that the execution environment has access to. The front end of the scope chain is always the variable object of the environment in which the code is currently executed.

4. Active object

If the current execution environment is a function, the active object is used as a variable object.

5. Executable code

1) Global code: for example, loading external JS files or code within local tags. Global code does not include code inside the function.

2) function code: code in function body

3) eval code: the eval () function evaluates a string and executes the JS code in it, such as eval ("alert ('helloworld')").

6. Execute the context stack

In a JS program, multiple execution contexts are bound to be generated, and the JS engine handles them as a stack, that is, the execution context stack.

7. Scope

JS is a language without block-level scope (the curly braces code blocks of if, for and other statements or individual curly braces code blocks cannot form a local scope), so the formation of the local scope of js is formed by and only the code blocks defined in the function's curly braces, that is, the function scope.

8. Domain chain

It is the implementation of scope rules, through the implementation of scope chain, variables can be accessed in its scope, and functions can be called in its scope.

The scope chain is an one-way linked list, and each node on the linked list is the variable object of the execution context. the head of the one-way linked list (the first node that can be accessed) is always the variable object (active object) of the function being called and the tail is always the global active object.

9. Closure

Function objects can be related to each other through the scope chain, and the data in the function body (variables and function declarations) can be stored in the function scope, which is called "closure" in the computer science literature.

From a technical point of view, the functions of JS are all closures: the functions are all objects, they are all associated with the scope chain, and the data in the function is saved in the scope of the function.

At this point, I believe that you have a deeper understanding of the "collation of the basic knowledge points of JS", you might as well come to the actual operation! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report