📅  最后修改于: 2020-10-25 10:29:40             🧑  作者: Mango
条件/决策结构在执行指令之前评估条件。
下表对JavaScript中的条件构造进行了分类。
Sr.No | Statement & Description |
---|---|
1 | if Statement
An ‘if’ statement consists of a Boolean expression followed by one or more statements . |
2 | if…else 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 else…if ladder is useful to test multiple conditions. Following is the syntax of the same. |
4 | switch…case Statement
The switch statement evaluates an expression, matches the expression’s value to a case clause and executes the statements associated with that case. |