📜  javascript 开关 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:37.808000             🧑  作者: Mango

代码示例6
var color = "yellow";
var darkOrLight="";
switch(color) {
    case "yellow":case "pink":case "orange":
        darkOrLight = "Light";
        break;
    case "blue":case "purple":case "brown":
        darkOrLight = "Dark";
        break;
    default:
        darkOrLight = "Unknown";
}