In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the relevant knowledge of JavaScript initialization will be improved, the content is detailed and easy to understand, the operation is simple and fast, it has certain reference value, I believe that after reading this JavaScript initialization will improve the article will have something to gain, let's take a look.
JavaScript initialization does not promote
Only declared variables in JavaScript will be promoted, not initialized ones.
The results of the following two examples are different:
Example 1
Var x = 5; / / initialize x
Var y = 7; / / initialize y
Elem = document.getElementById ("demo"); / / find the element
Elm [XSS _ clean] = x + "" + y; / / display x and y
Example 2
Var x = 5; / / initialize x
Elem = document.getElementById ("demo"); / / find the element
Elm [XSS _ clean] = x + "" + y; / / display x and y
Var y = 7; / / initialize y
Example 2's y outputs undefined because the variable declaration (vary) is promoted, but initialization (yinitialization 7) is not promoted, so the y variable is an undefined variable.
Example 2 looks like the following code:
Var x = 5; / / initialize x
Var y; / / statement y
Elem = document.getElementById ("demo"); / / find the element
Elm [XSS _ clean] = x + "" + y; / / display x and y
Y = 7; / / set y to 7
This is the end of the article on "will JavaScript initialization improve?" Thank you for reading! I believe you all have a certain understanding of the knowledge of "will JavaScript initialization improve". If you want to learn more, you are 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.