In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
In this article, the editor introduces in detail "what is the meaning of the temporary dead zone in es6", the content is detailed, the steps are clear, and the details are handled properly. I hope that this article "what is the meaning of the temporary dead zone in es6" can help you solve your doubts.
In es6, a temporary dead zone is a syntax error, which means that the let and const commands make the block form a closed scope. Until the variable is declared with the let and const commands, the variable is not available. Es6 sets a proper noun for this error called temporary dead zone.
This tutorial operating environment: windows10 system, ECMAScript version 6. 0, Dell G3 computer.
What is a temporary dead zone in es6
Temporary dead zone: Temporal Dead Zone abbreviated as TDZ
In ES6, two new commands let and const are introduced, and there is no variable promotion in the variables defined by these two commands, and the variables are not available until they are declared with let and const, which is called a temporary dead zone in syntax.
Console.log (a) let a = 100 / / ReferenceError
What do you mean? That is to say, es6 sets a proper noun for this kind of error called temporary dead zone. In fact, it simply refers to a grammatical error.
When the control flow of the program is instantiated in a new scope (module function or block scope), the variables declared with let/const in this scope will be created in the scope first, but they cannot be accessed because they are not lexically bound at this time, and an error will be thrown if accessed. Therefore, the time between the time when the running process enters the scope to create a variable and the time when the variable can be accessed is called a temporary dead zone.
If you still can't remember, you only need to understand the following sentence:
ES6 states that the let/const command causes the block to form a closed scope. If you use a variable before you declare it, an error will be reported.
In short, within the code block, the variable is not available until the let command is used to declare it.
Grammatically, this is called a "temporary dead zone" (temporal dead zone, referred to as TDZ).
After reading this, the article "what is the meaning of temporary dead zone in es6" has been introduced. If you want to master the knowledge points of this article, you still need to practice and use it yourself. If you want to know more about related articles, welcome to follow the industry information channel.
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.