Comparing values in javascript
This question already has an answer here:
The difference between ==
and ===
is that the first one (double equals) does type coercion, which can lead to goofy results:
0 == false
true
0 === false
false
It is usually recommended to use ===
as that will provide more predictable results and evaluate the true types of the values you're comparing.
下一篇: 在javascript中比较值