1. The difference between let and const:
1) Let can be modified, const is a constant cannot be modified;
2. The difference between Let,const and Var:
1) Let,const There is no variable promotion; So don't worry about pre-interpretation and scope issues;
2) repeated declaration of the same variable is not allowed under the same block-level scope;
3) ES6 allows declaring functions within a block-level scope,
A function declaration is similar to, that is, var
promoted to the head of a global scope or function scope,
Also, the function declaration is promoted to the head of the block-level scope where it resides;
4) ES6 in order to maintain compatibility, the var
function
global variables declared by commands and commands are still properties of global objects, and on the other hand, the let
const
global variables declared by commands, commands, and class
commands are not attributes of global objects. In other words, starting with ES6, the global variable will gradually decouple from the properties of the global object.
Es6--let and Const commands