NextGen Knowledge Center

Comparison Operators

Comparison operators are used in logical statements to determine equality or difference between variables or values. In this table, the x-variable has a value of 5 to explain the JavaScript Comparison operators:

OperatorDescriptionComparingReturns
==is equal tox==8false
x==5true
!=is not equal tox!=8true
>is greater thanx>8false
<is less thanx<8true
>=is greater than or equal tox>=8false
<=is less than or equal tox<=8true