Outline

Relational operators in JavaScript are used to determine if one value is:

  • greater than another — >
  • greater than or equal to another — >=
  • less than another — <
  • less than or equal to another — <=

These operators work just like they did in your math class, so you may be familiar with them. But that's okay if you don't remember. Here's a brief refresher.

The greater than operator evaluates to true if the value on the left side of the operator is greater than the value on the right. If the two values are equal, it will still evaluate to false. The greater than or equal to operator evaluates to true if the value on the left side of the operator is greater than or equal to the value on the right side of the operator.

The less than operator evaluates to true if the value on the left side of the operator is less than the value on the right. If the two values are equal, it will still evaluate to false. The less than or equal to operator evaluates to true if the value on the left side of the operator is less than or equal to the value on the right side of the operator.

You can follow along with this exercise by forking this StackBlitz project.

If you want to read more about relational operators, you can do so at this blog post.

 

I finished! On to the next chapter