After the assignment and arithmetic operators, the third set of operators I want to introduce is comparison operators.
Comparison operators always returns a boolean, a value that’s
false, and they are divided in 2 groups: equality operators , and disequality comparison operators.
These are equality operators:
===checks for equality
!==checks for inequality
These are disequality comparison operators:
<means “less than”
<=means “less than, or equal to”
>means “greater than”
>=means “greater than, or equal to”
You can use them to compare two numbers, or two strings.
Note that we also have
!== because they can prevent some subtle problems.
Lessons this unit:
|1:||▶︎ Comparison operators|
|3:||How to use `else`|
|5:||The ternary operator|