codecamp

JavaScript if、else if语句中代码的执行顺序

function myTest(val) {
if (val < 5) {
return "Less than 5";
} else if (val < 10) {
return "Less than 10";
} else {
return "Greater than or equal to 10";
}
}


// Change this value to test
myTest(7);
JavaScript else if语句
JavaScript 同时使用if、else if 语句
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定