ES6 - Decision Making



A conditional/decision-making construct evaluates a condition before the instruction/s are executed.

Decision Making

Conditional constructs in JavaScript are classified in the following table.

Sr.No Statement & Description
1 if Statement

An if statement consists of a Boolean expression followed by one or more statements .

2 ifelse Statement

An if statement can be followed by an optional else statement, which executes when the Boolean expression is false.

3 The else.. if ladder/nested if statements

The elseif ladder is useful to test multiple conditions. Following is the syntax of the same.

4 switchcase Statement

The switch statement evaluates an expression, matches the expressions value to a case clause and executes the statements associated with that case.

Advertisements