JS Conditional Statements
Download (.odt) Download (Markdown)Return a boolean (true or false) value.
Bigger/smaller
[hook]Smaller than:
Bigger than:
Smaller than or equal to:
Bigger than or equal to:
Equality
[hook]Equality with data type conversion:
Equality without data type conversion (strict):
Negative equality with data type conversion:
Negative equality without data type conversion (strict):
Logical operators
[hook]Logical AND (both conditions have to return true):
Logical OR (at least one condition has to return true):
Usecases
[hook]If-else statement
Switch statement
If a break is missing after a case:
One piece of code is missing from a case:
Ternary operator
Assign a value based on a conditional statement to a variable.
Nested ternary operator: