2. Conditional Statements
2.1. Relational and Logical Operators
To effectively use if-else statements, you must learn how to properly declare conditional statements. If the conditions are not stated properly, if-else statements cannot execute their intended purpose.
Comparison operators are used in conditional statements to compare different values. You may recall
from your grade 8 Computer Science subject that these operators were also used. The table below lists the
comparison operators that can be used in JavaScript statements.
In more advanced programming problems, you may need to define more than one conditional
statement for a single line of if statement. To combine multiple conditional statements, we make use of logical
operators. The table below lists the different logical operators present in JavaScript.