JavaScript Conditionals


If Else Statement


Switch Statement

NOTE: The default case is optional. No break statement is needed for the last case in the switch statement.


Ternary Operator

The ternary operator is a shorthand way to write an if else statement.


Examples

Down Arrow

X =

X > 0 =