1.循环
1.1while
代码语言:javascript
复制while(condition) {
statement #1
statement #2
...
}
1.2.for
代码语言:javascript
复制for(variable declaration;expression;Increment) {
statement #1
statement #2
…
}
1.3.for...in
代码语言:javascript
复制for(variable in range) {
statement #1
statement #2
…
}
1.4.break 和 continue
- break终止该层循环
- continue结束本次迭代
2分支控制
2.1.if...else
代码语言:javascript
复制if(condition) {
statement #1
statement #2
...
} else if(condition) {
statement #3
statement #4
} else {
statement #5
statement #6
}
2.2.switch
代码语言:javascript
复制switch(expression) {
case expression #1:
statement #1
...
case expression #2:
statement #2
...
case expression #N:
statement #N
...
default:
statement #Default
...
}