In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Today, I would like to share with you the relevant knowledge of what the block-level scope of javascript does. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article.
The role of block-level scope: to resolve naming conflicts caused by too many global variables and functions. JavaScript turns a blind eye to repeated declarations, resulting in errors in the run results, and block-level scopes can solve this problem, allowing each developer to use his or her own variables without having to worry about messing up the global scope.
The operating environment of this tutorial: windows7 system, javascript1.8.5 version, Dell G3 computer.
What is a block-level scope?
The statement set in any pair of curly braces ({and}) belongs to a block, in which all variables defined are invisible outside the code block, which we call block-level scopes, such as for, while, if.
JavaScript does not have block-level scope (before the es6 standard came out, javascript did not have block-level scope), that is, a variable is defined in the code block of javascript, and the variable can still be used outside that code block, for example:
Vari= 1; if (iTunes 1) {var bread2;} alert (b); / / output 2 function outputNumbers (count) {for (vari=0;i)
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.