In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how to solve the javascript + [[]] [+ []] + [+ []] = 10 problem". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn how to solve the "javascript + [[]] [+ []] + [+ []] = 10 problem"!
This is a Javascript language problem, a completely valid equation, if you don't believe in yourself, you can try it. Let's take a look at the answer of the master:
+ [[]] [+ []] + [+ []]
If you split this expression, it is equal to:
+ [[]] [+ []] + [+ []]
In JavaScript, + [] = 0 is exactly right. + converts some characters into numbers, where the formula becomes + "" or 0.
Therefore, we can simplify (+ has a higher priority than +):
+ [[]] [0] + [0]
Because [[]] [0] means: get the first element of [[]], this results in the following result:
[[]] [0] returns an internal array ([]). According to the language specification, we say that [[]] [0] = [] is incorrect, but let's call this internal array A to avoid misspelling.
+ [[]] [0] = A + 1, because + + means "plus one".
+ [[]] [0] = = + (A + 1); in other words, what you get is always a number (+ 1 does not necessarily get a number, but + must be).
Similarly, we can simplify this pile of code more clearly. Let's change A back to []:
+ ([] + 1) + [0]
In JavaScript, this is also true: [] + 1 = = "1" because [] = = "" (which is equivalent to a join of the internal elements of an empty array), so:
+ ([] + 1) = = ("" + 1), and + ("+ 1) = = + (" 1 ") and + (" 1 ") = 1
Let's simplify again:
1 + [0]
Again, in Javascript, this is true: [0] = "0", because this is equivalent to a join of internal elements of an array with one element. The elements will be used to separate. When there is only one element, you can infer that the result of the process is its own first element.
So, finally we get (number + string = string):
1 + "0" = = "10" / / Yay! Thank you for your reading, the above is "javascript + [[]] [+ []] + [+ []] = 10 problem how to solve the content, after the study of this article, I believe you on the javascript + [[]] [+ []] + [+ []] = 10 problem how to solve this problem has a deeper understanding, the specific use of the situation also needs to be verified by practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.