84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
0.05是不是等于0
0.00是不是等于0
我是用parseinit。。。结果出问题了
JavaScript does not strictly distinguish between decimals and integers, so you can directly determine whether they are equal, but it is best to use ===而不是==. Three equal signs are strictly equal. You can search on Baidu for specific differences
===
==
......0.000 is of course equal to 0
Just use it===and it’ll be fine
0.000 === 0 // true 0.08 === 0 // false
You have to pay attention to the error in decimals. It is best to provide an accuracy judgment, such as Math.abs(a) < 0.0000001
Math.abs(a) < 0.0000001
Math.abs(0.1 + 0.2 - 0.3) < 0.0000001 // true 0.1 + 0.2 - 0.3 === 0 // false
parseint is converted to plastic. Think about it, what is 0.05 converted to plastic?
JavaScript does not strictly distinguish between decimals and integers, so you can directly determine whether they are equal, but it is best to use
===
而不是==
. Three equal signs are strictly equal. You can search on Baidu for specific differences......
0.000 is of course equal to 0
Just use it
===
and it’ll be fineYou have to pay attention to the error in decimals. It is best to provide an accuracy judgment, such as
Math.abs(a) < 0.0000001
parseint is converted to plastic. Think about it, what is 0.05 converted to plastic?