Skip to content

Latest commit

 

History

History
29 lines (20 loc) · 754 Bytes

File metadata and controls

29 lines (20 loc) · 754 Bytes

We can also write expressions that return boolean values.

Here's an expression that evaulates to a boolean.

1 > 2
  • Can you work out what value this expression evaluates to?

The > symbol in the expression is a comparison operator. Comparison operators compare two values. This operator checks to see if the number on the left is bigger than the number on the right.

1 is not bigger than 2 so this expression returns false.

More comparison operators

>   greater than
<   less than
<=  less than or equal
>=  greater than or equal
=== same value
!== not the same value

Exercise

  • Open exercise.js and follow the instructions.
  • Open a node console, and write some expressions that use comparison operators