...

/

Comparison and Ternary Operators

Comparison and Ternary Operators

Learn how to use comparison and ternary operators to evaluate conditions and boolean values.

Let’s see some booleans values. Booleans are either true or false.

Comparison operators

We can compare two numbers with >, >=, ==, ===, <=, <. We will discuss the difference between == and === soon. For the rest of the operators, the result of the comparison is a boolean.

The ! operator

The ! operator negates its operand. True becomes false, and false ...