JavaScript Comparison Operator With Example

JavaScript Operator Definition:

An operator that performs some operation on single or multiple operands and produces a result is called Operators.

An Operators are symbols or keyword that enable JavaScript to perform some sort of actions.


JS Comparison Operators

The following are the comparison operators supported by JavaScript.

JavaScript comparison operator also determine the two operands satisfied the given condition

Operators Description
== Compares the equality of two operands without considering type.
=== Compares equality of two operands with type.
!= Compares inequality of two operands.
> Checks whether left side value is greater than right side value. If yes then returns true otherwise false.
< Checks whether left operand is less than right operand. If yes then returns true otherwise false.
>= Checks whether left operand is greater than or equal to right operand. If yes then returns true otherwise false.
<= Checks whether left operand is less than or equal to right operand. If yes then returns true otherwise false.

Example:

Result:

(a == b) => false 
(a < b) => true 
(a > b) => false 
(a != b) => true 
(a >= b) => false 
a <= b) => true
Set the variables to different values and different operators and then try...


Read Also: