JavaScript 是 Web 的编程语言
常见if switch:
if 语句 - 只有当指定条件为 true 时,使用该语句来执行代码
if...else 语句 - 当条件为 true 时执行代码,当条件为 false 时执行其他代码
switch 语句 - 使用该语句来选择多个代码块之一来执行
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<script type="text/javascript">
if(){
}else if(){
}else if(){
}else{
}
嵌套
if(){
if(){
}else{
}
}else{
}
switch
switch(){
case 1:
alert();
break;
default:
alert();
} /*如果没有break就继续向下执行*/
</script>
</body>
</html>