Possible Duplicate:
JavaScript === vs == : Does it matter which “equal” operator I use?
Javascript operator !==
What's the difference between !=
and !==
?
Can you give me an example where using !=
gives another result than using !==
?
Possible Duplicate:
JavaScript === vs == : Does it matter which “equal” operator I use?
Javascript operator !==
What's the difference between !=
and !==
?
Can you give me an example where using !=
gives another result than using !==
?
alert(1 != true);
alert(1 !== true);
The first one is false, the second true.
!=
accept 1 as equals of true, null as equals of false and some others (because the values are automatically casted when being compared).!==
accept only "real" equalities (i.e. compares both the value and the type).