最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
js中with的和case的用法
时间:2022-06-30 09:56:39 编辑:袖梨 来源:一聚教程网
switch Statement
Enables the execution of one or more statements when a specified expression's value matches a label.
switch (expression) {
case label :
statementlist
case label :
statementlist
...
default :
statementlist
}
Arguments
expression
The expression to be evaluated.
label
An identifier to be matched against expression. If label === expression, execution starts with the statementlist immediately after the colon, and continues until it encounters either a break statement, which is optional, or the end of the switch statement.
statementlist
One or more statements to be executed.
Remarks
Use the default clause to provide a statement to be executed if none of the label values matches expression. It can appear anywhere within the switch code block.
Zero or more label blocks may be specified. If no label matches the value of expression, and a default case is not supplied, no statements are executed.
Execution flows through a switch statement as follows:
Evaluate expression and look at label in order until a match is found.
If a label value equals expression, execute its accompanying statementlist.
Continue execution until a break statement is encountered, or the switch statement ends. This means that multiple label blocks are executed if a break statement is not used.
Enables the execution of one or more statements when a specified expression's value matches a label.
switch (expression) {
case label :
statementlist
case label :
statementlist
...
default :
statementlist
}
Arguments
expression
The expression to be evaluated.
label
An identifier to be matched against expression. If label === expression, execution starts with the statementlist immediately after the colon, and continues until it encounters either a break statement, which is optional, or the end of the switch statement.
statementlist
One or more statements to be executed.
Remarks
Use the default clause to provide a statement to be executed if none of the label values matches expression. It can appear anywhere within the switch code block.
Zero or more label blocks may be specified. If no label matches the value of expression, and a default case is not supplied, no statements are executed.
Execution flows through a switch statement as follows:
Evaluate expression and look at label in order until a match is found.
If a label value equals expression, execute its accompanying statementlist.
Continue execution until a break statement is encountered, or the switch statement ends. This means that multiple label blocks are executed if a break statement is not used.
相关文章
- 无期迷途主线前瞻直播总结 无期迷途主线前瞻直播内容介绍 11-22
- 以下哪种非遗技艺是用针在纸上绣画 蚂蚁新村11月21日答案 11-22
- 江南百景图听风塔怎么样 11-22
- 原神恰斯卡圣遗物怎么搭配 11-22
- 2024年霸王茶姬11月22日口令是什么 2024.11.22霸王茶姬口令介绍 11-22
- 光遇11.21季节蜡烛在哪里 光遇11月21日季节蜡烛位置攻略 11-22