-
Greater than
-
Less than
-
Greater than or equal
-
Less than or equal
-
checks that the number on the left is strictly greater than the number on the right.
-
= (written as >=) checks that the number on the left is greater than or equal to the number on the right.
-
< checks that the number on the left is strictly lesser than the number on the right.
-
<= (written as <=)
checks that the number on the left is lesser than or equal to the number on the right. -
a > b returns true when a is strictly greater than b
-
a < b returns true when a is strictly lesser than b
-
The result of comparisons is always going to be a boolean. Either true or false.
Equality comparison
= is an assignment == or === is a comparison - use === until you learn about == and understand why you don't use it.
- The = operator is always used for assignment.
- The === operator (written as ===) is always used for equality comparison.
- Confusing = and === is a common mistake. Don't worry!
- The !== operator (written as !==) returns true when the 2 numbers given are NOT the same.
Chapter recap
Recap
-
checks that the number on the left is strictly greater than the number on the right.
-
= (written as >=) checks that the number on the left is greater than or equal to the number on the right.
- < checks that the number on the left is strictly lesser than the number on the right.
<= (written as <=)
checks that the number on the left is lesser than or equal to the number on the right.- a > b returns true when a is strictly greater than b
- a < b returns true when a is strictly lesser than b
- The result of comparisons is always going to be a boolean. Either true or false.
- The = operator is always used for assignment.
- The === operator (written as ===) is always used for equality comparison.
- Confusing = and === is a common mistake. Don't worry!
- The !== operator (written as !==) returns true when the 2 numbers given are NOT the same.