Submodule 6.2: Making Decisions

  • Comparison operators
  • If statements
  • Logical operators

Comparison operators

The table below shows the comparison operators available in JavaScript.

These operators are used to test whether something is true or false. 

For example, they can be used to test whether two variable values are equal or if the one is greater than the other.

Usually, depending on whether the result is true or false we take different actions. 

Operator    Description
==          equal to
!=          not equal
>           greater than
<           less than
>=          greater than or equal to
<=          less than or equal to