In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "JS has what development tips," interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let Xiaobian take you to learn "JS has what development tips"!
1. typeof misunderstanding
Declaring a variable var a, typeof a is often misunderstood as finding the type of variable a, but in fact it is finding the "type of the current value" of variable a. As shown in the figure, when the value of a changes, the result of typeof a also changes.
2. difficult to distinguish between true and false
False values in js include "", 0,-0, NaN, null, undefined, false, remember that empty strings are also false values, while empty arrays [] and empty objects {} are not false values. This can be verified by the following code:
3. == and ==
What does this code print? The result is a == c, and I can't believe it.== The difference between == and == is that == checks for "value equality" while == checks for "value and type equality." But that's not accurate. The correct way to say this is that == checks for equality of values if type conversion is allowed, and === checks for equality of values if type conversion is not allowed; hence === is often called "strict equality."
4. Comparison between types
What's the printout on it? And it says,"what do I do?" This is why B is here.
< 和 >b is converted to an invalid number NaN during the comparison process,"the specification setting NaN is neither greater nor less than any value."== The comparison is false because neither 42 == NaN nor "42" == "suyan" can be true.
5. Implement an isNaN function yourself
This takes advantage of a property of NaN values, namely that NaN is the only value in the entire language that is not equal to itself. Thus NaN is such that x != x is the only true value.
6. IIFE
Don't be confused by the above function, change your posture:
At this point, I believe everyone has a deeper understanding of "JS has what development tips", may wish to actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!
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.