let is a new copy command in ES6. The let assignment command can only be called in the {} code block. The following is an example of the let command in es6. The specific content is as follows:
1. The usage of the let command is similar to the var command, but the variables declared by the let command are only valid within the code block where the let is located.
1 2 3 4 5 6 |
|
2. The let command does not have the phenomenon of "declaration in advance", so the variables must be declared first and then used
1 2 3 4 |
|
3. As long as the let command exists in the current block-level scope, the variables it declares The variable is bound to this block-level scope and is no longer affected by external influences
1 2 3 4 5 |
|
4. The let command does not allow repeated declaration of the same variable in the same scope
1 2 3 4 |
|
The above The above is the let command in ES6 introduced by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank you all for your support of the PHP Chinese website!
For more detailed articles related to the let command in ES6, please pay attention to the PHP Chinese website!