Let (block-level scope) : local parameter definitions, changes that can only be used to declare their modules. In the case of closures, if variables are used in the closure, the variables declared by var will change as the outer layer changes.

Var (full scope) : There is variable promotion. All variables with var and function declarations are pre-defined by default before JavaScript code is executed in the current scope.

Note: Function declarations take precedence over variable declarations. Function promotion only improves the function declaration, not the function expression.Copy the code

Const (block-level scope) : Const is used to declare one or more constants, which must be initialized and cannot be modified after initialization.

Note: Static variables are immutable for constants, but for objects, the value of the property is mutable. The address does not change.Copy the code