Var and let the difference in the strict mode

1. Even in strict mode, var to declare a variable repeat support

2.var can use variables and then declare variables, so-called variable lift

3.var scope is a function, and if the variable defined in a for loop, the outer loop may be used,

  let's block scope, it can only be used within the same braces.

 

 

 

Source: https://www.php.cn/js-tutorial-413074.html

Guess you like

Origin www.cnblogs.com/panjingshuang/p/11614397.html