JavaScript Conditional Statements

Conditional statements control the flow of a program by executing code only when certain conditions are met. Therefore, they are fundamental part of the control flow a program.

The control flow is the order in which a computer executes statements in a script. When code is run, each statement is executed from top to bottom, unless there statements that alter the control flow, like conditionals statements or loops.

In JavaScript, there are two types conditional statements, if...else statement and the switch statement.