ES6's let const var difference

[1] Var is a variable that can be declared in advance, it has no scope, the default is, there is no need to always write var

b=3
b //3

[2] Let can not declare front variables (must be defined before use, exists in the block-level scope)

a=3
let a//undefined

[3] The constant declared by const cannot be changed
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_42782491/article/details/113553797