Predict 如果/else 输出
预测输出 入门
题目
什么做 这个 code print 到 console?
代码
let score = 75;
if (score >= 80) {
console.log("A");
} else if (score >= 60) {
console.log("B");
} else {
console.log("C");
}
提示
检查每个 threshold in 顺序: 80 首先, 然后 60.
解释
score is 75. The first condition score >= 80 is false (75 < 80). The second condition score >= 60 is true (75 >= 60), so the "B" branch runs. The else branch is skipped. The output is: B
相关资源
相关课程
- 条件 (如果/else)
学习如何如果/else 条件工作.
查阅不认识的术语
新手友好的术语表用大白话解释编程术语——变量、函数、DOM、Promise 等等。
解读错误信息
用大白话解释常见错误——什么意思、为什么发生、如何修复。
动手做项目
通过引导式项目应用所学,含起始代码与解决方案。