Like when doing math, there’s a set of operators that work on booleans. They are used to compare two values, on the left and right of the operator, to produce a boolean value.
To find out when two values are equal, use the triple equals operator (“===”).
15.234 === 15.234
We can also determine if two values are not equal using the triple not equal operator (“!==”).
15.234 !== 18.4545
It’s important to know that strings containing a number and an actual number are not equal.
'10' === 10
Greater than and less than
Comparing two numbers is useful, for example, to determine which of two is larger or smaller. This first example is a comparison of 10 and 5 to see if 10 is larger, using the greater than operator (“>”).
10 > 5
Next we use the less than operator (“<”) to determine if the left value is smaller.
20.4 < 20.2
That example gives back (or returns) false, because 20.4 is not a smaller number than 20.2.
Combining a comparison of equality and size can be done with the greater than or equal to and less than or equal to operators (“>=” and “<=” respectively).
10 >= 10
10 <= 5