Possible Duplicate:
Javascript === vs == : Does it matter which “equal” operator I use?
Are != and !== are respectively the same as == and ===?
Possible Duplicate:
Javascript === vs == : Does it matter which “equal” operator I use?
Are != and !== are respectively the same as == and ===?
!== and === are strict comparison, and == / != are loose comparison. It's best to use strict comparison.
true == 1 gives you true
true === 1 gives you false
Reason is that == compares only the value (so that 1, '1' is considered as true)
=== compares the value and the type.
Same thing in PHP.
== compares the value of object while === compares the object value and type.
yes it is.
<script>
var str = '1234';
var int = parseInt('1234');
if (int !== str)
{
alert('returns true and alerts');
}
if (int === str)
{
alert('returns false');
}
</script>