Difference between "==" and "===" in java script [duplicate]
Possible Duplicate:开发者_高级运维
Javascript === vs == : Does it matter which “equal” operator I use?
Hi
I am not clear why there are two ==
and ===
comparator operators in java script.
The equality operator ==
coerces, or converts the data type temporarily to see if it's equal to the other operand whereas the identity operator ===
doesn't need to do any converting whatsoever since it directly compares them without conversion meaning it's stricter and faster.
2=='2'
true
2==='2'
false
精彩评论