js-variable object

Talk about variable objects

  1. The variable object is an object composed of all variables (variable function parameters) in the current code segment
  2. The variable object is activated in the execution context. Only when the variable object is activated, can all variables be used in this code
  3. Variable objects are divided into global variable objects and local variable objects
  4. Window is the global variable object, global variables and methods are the properties and methods of the window object
  5. The local variable object is created when entering the local execution context, and contains all the variables in the current scope (variable function parameters)
  6. First, the local variable object contains all the formal parameters and actual parameters
  7. Check all the functions in the current code segment and put them in the variable object in the form of key-value pairs. If the attribute with the same name already exists, it will be overwritten directly
  8. Check all declared variables, create key-value pairs in the variables and save them, if they have the same name as formal parameters or functions, they are not allowed to affect their values

Guess you like

Origin blog.csdn.net/qq_42592823/article/details/115293073