Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

What does the js execution context refer to

Shulou Source: shulou.com Published: 2022-05-31 10:38:31 10月02日 Update

This article mainly explains what the js execution context refers to. Interested friends may wish to take a look at it. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn what the js execution context refers to.

Description

1. Execution context refers to the execution environment of the current function (or global object window) generated in the execution stack when the function is called, such as isolating the container boundaries of the outside world, keeping accessible variables, this objects, and so on.

2. Every time a function is called, a new execution environment is created at the top of the stack. The bottom of the stack is always the global context, and the top of the stack is the context in which the code is executed in the active state.

Example

Let fn, bar; / / 1, enter global context bar = function (x) {let b = 5; fn (x + b); / / 3, enter fn function context}; fn = function (y) {let c = 5; console.log (y + c); / / 4, fn stack out, bar stack out}; bar (10) / / 2, enter the bar function context at this point, I believe you have a deeper understanding of "what the js execution context refers to", you might as well to actually operate it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Up and down context environment function global content object learning practical deeper world code global interest variable stack instance practicality reality container Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple MySQL Microsoft Xiaomi Docker