In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces "what does let refer to in es6". In daily operation, I believe that many people have doubts about what let refers to in es6. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts of "what does let mean in es6?" Next, please follow the editor to study!
In es6, let is a keyword used to declare variables; this keyword is only valid in the declared block of code, an error will be reported outside the specified block of code, and there is no scope promotion, no repeated declaration, a temporary dead zone, and the syntax is "let name=value;".
This tutorial operating environment: windows10 system, ECMAScript version 6. 0, Dell G3 computer.
What is es6's let?
Let is a command in es6 that declares a variable, which is valid only in the code block it declares. If you leave this code block, an error will be reported. It is also very suitable for for loops, where the value of I only takes effect in the loop statement and cannot be obtained on the outside.
The var command declares a global variable, and I is a global variable that only outputs the final value. On the other hand, let only works in the loop statement block, and each loop will redeclare an I, so each loop can get the corresponding value.
The variable of the for loop is the parent scope and is not in the same scope as the variable (child scope) defined by let in the loop body.
For example:
/ / 1. Valid in its own code block {let a = 1; var b = 2;} console.log (b); / / 2console.log (a); / / an is not defined//2. In the for loop statement block, there is a valid for (var item0uti).
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.