Comparing Values
Comparing values is a binary operation. We are comparing the values of the left operand versus the right operand.
JavaScript's Comparison Operators
In JavaScript they are written like this:
Greater/less than:
a > b
,a < b
.Greater/less than or equals:
a >= b
,a <= b
.Equals:
a == b
, please note the double equality sign==
means the equality test, while a single onea = b
means an assignment.Not equals: In math the notation is
≠
, but in JavaScript it’s written asa != b
.
Examples
Comparison operation will result into a Boolean value
Recommended Readings
Comparisons (Link)
Last updated