Possible Duplicates:
Javascript === vs == : Does it matter which “equal” operator I use?
Javascript operator !==
Look at this commit
Is !=
same as !==
in JavaScript?
The strict inequality operator ( !== ) checks whether its two operands are not equal, returning a Boolean result. Unlike the inequality operator, the strict inequality operator always considers operands of different types to be different.
Equality operators: == and != The result type for these operators is bool . The equal-to operator ( == ) returns true if both operands have the same value; otherwise, it returns false . The not-equal-to operator ( != ) returns true if the operands don't have the same value; otherwise, it returns false .
Inequality Operators: !=!= : Converts values if variables are different types before checking for inequality. !== : Checks both type and value for the two variables being compared.
The strict equality operator ( === ) checks whether its two operands are equal, returning a Boolean result. Unlike the equality operator, the strict equality operator always considers operands of different types to be different.
They are subtly not the same.
!=
checks the value!==
checks the value and type
'1' != 1 // false (these two are the same) '1' !== 1 // true (these two are **not** the same).
In the previous example. The first half of the expression is a string, the second half is an integer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With