Notes
==
is same as equal to.
var x = 1;
var y = 4;
document.write(x == y);
Output: false
===
is same as equal value and equal type.
var x = 5;
var y = "5";
document.write(x === y);
Output: false
!=
is same as not equal.
var x = 5;
var y = 3;
document.write(x != y);
Output: true
!==
is same as not equal value or not equal type.
var x = false;
var y = true;
document.write(x !== y);
Output: true
The output will be true because x and y are same type but not equal.
>
is same as greater than.
var x = 2;
var y = 3;
document.write(x > y);
Output: false
<
is same as less than.
var x = 2;
var y = 3;
document.write(x < y);
Output: true
>=
is same as greater than or equal to.
var x = 2;
var y = 2;
document.write(x >= y);
Output: true
<=
is same as less than or equal to.
var x = 5;
var y = 4;
document.write(x <= y);
Output: false
?
is used for ternary operations.
var k = 4;
document.write(k > 5 ? 'yes' : 'no');
Output: no
If k is more than 5, then the output will be yes if not the output will be no.