Files
ClassContent/历届学生/吴欣阳/每天课程/2021-06-10/条件语句.html
2024-09-27 02:06:13 +08:00

82 lines
1.9 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>条件语句</title>
</head>
<body>
</body>
<script>
// if (判断条件) {
// }
// var a = true;
// if (a) {
// console.log("出去吃饭");
// } else {
// console.log("在家吃饭");
// }
// if (a) console.log("出去吃饭");
// else console.log("在家吃饭");
// 三元(目)运算
// a ? console.log("出去吃饭") : console.log("在家吃饭")
// var cj = 99999;
// if ( cj < 60 ) {
// console.log("不及格");
// } else if ( 60 <= cj && cj <= 70 ) {
// console.log("一般");
// } else if ( 70 < cj && cj <= 80 ) {
// console.log("普通");
// } else if ( 80 < cj && cj <= 90 ) {
// console.log("优秀");
// } else if ( 90 < cj && cj <= 100 ) {
// console.log("学霸");
// } else {
// console.log("分数错误最高100分");
// }
// var name = "bmy1", pwd = "123"
// if (name == "bmy") {
// if (pwd == "123") {
// console.log("用户名和密码都正确,可以登录");
// } else {
// console.log("密码错误");
// }
// } else {
// console.log("用户名错误");
// }
// if (name == "bmy" && pwd == "123") {
// console.log("用户名和密码都正确,可以登录");
// } else {
// console.log("用户名或密码错误,请检查");
// }
// switch 一个变量有多种数值的场景
var type = 1;
switch (type) {
case 1:
console.log("1111");
break;
case 2:
console.log("2222");
break;
default:
console.log("都不相等");
break;
}
</script>
</html>