codecamp

JavaScript 在switch语句中添加default语句

function myTest(val) {
var answer = "";
// Only change code below this line
switch (val) {
case "a":
answer = "apple";
break;
case "b":
answer = "bird";
break;
case "c":
answer = "cat";
break;
default:
answer = "stuff";
}
// Only change code above this line
return answer;
}


// Change this value to test
myTest(1);
JavaScript 使用switch语句进行多选项选择
JavaScript switch语句中的多个相同选项判断
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定