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

What are the types of js execution context

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly explains "what are the types of js execution context". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what are the types of js execution context".

1, global context: is the foundation, the default context type, any code that is not in the function is in the global context.

It does two things: create a global window object, set the value of this to be equal to this object, and a program has only one global context.

2. Function context: every time a function is called, a new context is created for that function.

Each function has its own context, and there can be any number of function contexts.

3. Eval function execution context: functions executed inside eval functions also have their own function context.

Example

Var name = 'globalName';function F1 () {console.log (name); console.log (F2); var name =' f1amerabbit; function F2 (argumentName) {console.log (argumentName);} F2 (name); console.log (sex);} F1 () Thank you for your reading, the above is the content of "what are the types of js execution context". After the study of this article, I believe you have a deeper understanding of the type of js execution context, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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