Equality and Inequalty operators
Demonstration of strict and normal equality and inequality operators
JavaScript
var a = "123",
b = 123,
result = "";
if (a == b) {
result = a + " is equal to " + b;
}
else {
result = a + " is not equal to " + b;
}
alert (result);
/* Try this using the equality operator (==):
1. Set the value of a to "123" (quotes) and the value of b to 123 (no quotes).
2. Set the value of a to true (no quotes) and the value of b to 1 (no quotes)
3. Set the value of a to true (no quote) and the value of b to 0 (no quotes)
4. Repeat the above using the strict equality operator (===), inequality operator (!=), and strict inequality operator (!==)
*/