What about == and === in javascript?
Possible Duplicate:
JavaScript === vs == : Does it matter which “equal” operator I use?
Difference between == and === in JavaScript
As we all know you can do either (value==other_value)
or (value===other_value)
to compare the two values, where ===
is the strict version of ==
.
But what is the real difference? Like what's so much better about ===
, respectively what advantages does ==
give you? Same for !=
and !==
?
The comparison is type-wise. '1' == 1
is true. However, '1' === 1
is false. If you don't know what type-wise comparison will bring you, go learn more about programming and your language.
In a nutshell, the ==
will perform type conversion and ===
will not. That conversion is expansive.
请阅读:JavaScript和==和===之间的区别
链接地址: http://www.djcxy.com/p/19432.html