js控制语句:
- If
if(condition1){
Sentence1
}else if(condition2){
S2
}else{
S3
}
- For
for(condition0;endCondition;change){
S
}
- While
while(condition){
s
}
- do-while
do{
s
change
}while(condition);
- switch-case
switch(item){
Case condition1:{
S1
Break //需要Break来阻止后续语句的运行
}case c2:{
S2
break
}default:{ //其他情况
S3
break
}
}