When was the variable object of the js global execution environment initialized?




figure 1. Global execution environment = global object
figure 2. Variable object of global execution environment = global object
figure 3. The variable object of the global execution environment only points to the global object, contains the contents of the global object, and inherits the global object. The establishment time of the two is also different, the global object is initialized on the page, and the global variable object is created during global precompilation, which is written in figure 3.
so what exactly is this global variable object?

Feb.28,2021

.
title question:
any JavaScript program, when the program starts running , the JavaScript interpreter initializes a global object for the program to use

first of all, the js runtime has a built-in Global object, which in the browser refers to the windows object
, so you can understand that windows is the global object and then the variables (objects, characters, ah) are actually properties of the global object

.

it should be understood this way:

  1. Global objects are some js built-in basic objects, including Global objects
  2. Global execution objects are some basic objects that run js in different environments, such as windows objects in browsers, environment base objects in nodejs, and so on
  3. ordinary global variable objects, which are actually properties (objects) of global objects
Menu