In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces how to use the additive operator in the ECMAScript operator, which is very detailed and has a certain reference value. Friends who are interested must read it!
The addition operator, the normal operator is represented by the plus sign (+)
Addition has some special behaviors when dealing with special values:
1. If a certain Operand is NaN, then the result is NaN
2.-Infinity plus-Infinity, the result is-Infinity
3. Infinity plus-Infinity, the result is NaN
4. + 0 plus + 0, the result is + 0
5.-0 plus + 0, the result is + 0
6.-0 plus-0, the result is-0
7. No automatic type conversion
Chestnut presents:
1. If a certain Operand is NaN, the result is NaN
Console.log (NaN + 30); / / NaN
2.-Infinity plus-Infinity, the result is-Infinity
Console.log (- Infinity +-Infinity); / /-Infinity
3. Infinity plus-Infinity, the result is NaN
Console.log (- Infinity + Infinity); / / NaN
4. + 0 plus + 0, the result is + 0
Console.log (+ 0) + (+ 0); / / 0
5.-0 plus + 0, the result is + 0
Console.log (- 0) + (+ 0); / / 0
6.-0 plus-0, the result is-0
Console.log (- 0) + (- 0); / / 0
7. No automatic type conversion
Console.log ("13" + 13); / / 1313
Console.log ("cgl" + 13); / / cgl13
Subtraction operator, subtraction operator (-), is also a commonly used operator:
Some special behaviors of the subtraction operator when dealing with special values:
1. If a certain Operand is NaN, then the result is NaN
2. Infinity minus Infinity, the result is NaN
3.-Infinity minus-Infinity, the result is NaN
4. Infinity minus-Infinity, the result is Infinity
5.-Infinity minus Infinity, the result is-Infinity
6. + 0 minus + 0, the result is + 0
7.-0 minus 0, and the result is-0
8. + 0 minus-0, the result is + 0
9. If an operator is not a number, the result is NaN
0. Automatic type conversion
1. If a certain Operand is NaN, the result is NaN
Console.log (NaN-30); / / NaN
2. Infinity minus Infinity, the result is NaN
Console.log (Infinity-Infinity); / / NaN function () {/ / follow order: www.gendan5.com
3.-Infinity minus-Infinity, the result is NaN
Console.log (- Infinity-(- Infinity)); / / NaN
4. Infinity minus-Infinity, the result is Infinity
Console.log (Infinity-(- Infinity)); / / Infinity
5.-Infinity minus Infinity, the result is-Infinity
Console.log (- Infinity-Infinity); / /-Infinity
6. + 0 minus + 0, the result is + 0
Console.log (+ 0-(+ 0)); / / 0
Seven,-0 minus 0, the result is-0
Console.log (- 0)-0); / /-0
8. + 0 minus-0, the result is + 0
Console.log (+ 0-(- 0)) / / 0
9. If an operator is not a number, the result is NaN
Console.log ("asd"-123); / / NaN
Automatic type conversion
Console.log (124123); / / NaN
These are all the contents of the article "how to use Additive operators in ECMAScript operators". Thank you for reading! Hope to share the content to help you, more related knowledge, 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: 223
*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.