The difference between var and let

1. Variables declared by let are no longer promoted, and must be declared before use.
2. The global variable declared by let is no longer a property of the window object
3. In the same scope, it is not allowed to use let to declare a variable repeatedly
4. The variable declared by let has a block-level scope, which can only be valid in the current block

Guess you like

Origin blog.csdn.net/ni15534789894/article/details/113051563