--- id: 56533eb9ac21ba0edf2244df title: Multiple Identical Options in Switch Statements challengeType: 1 videoUrl: '' localeTitle: 交换机语句中的多个相同选项 --- ## Description
如果从switch语句的case省略了break语句,则会执行以下case语句,直到遇到break 。如果您有多个具有相同输出的输入,则可以在switch语句中表示它们,如下所示:
switch(val){
情况1:
案例2:
案例3:
result =“1,2或3”;
打破;
案例4:
result =“4 alone”;
}
1,2和3的情况都会产生相同的结果。
## Instructions
写一个switch语句来设置以下范围的answer
1-3 - “低”
4-6 - “中”
7-9 - “高”
您需要为范围中的每个数字都有一个case语句。
## Tests
```yml tests: - text: sequentialSizes(1)应返回“Low” testString: assert(sequentialSizes(1) === "Low"); - text: sequentialSizes(2)应该返回“Low” testString: assert(sequentialSizes(2) === "Low"); - text: sequentialSizes(3)应返回“Low” testString: assert(sequentialSizes(3) === "Low"); - text: sequentialSizes(4)应返回“Mid” testString: assert(sequentialSizes(4) === "Mid"); - text: sequentialSizes(5)应返回“Mid” testString: assert(sequentialSizes(5) === "Mid"); - text: sequentialSizes(6)应返回“Mid” testString: assert(sequentialSizes(6) === "Mid"); - text: sequentialSizes(7)应该返回“High” testString: assert(sequentialSizes(7) === "High"); - text: sequentialSizes(8)应该返回“High” testString: assert(sequentialSizes(8) === "High"); - text: sequentialSizes(9)应该返回“High” testString: assert(sequentialSizes(9) === "High"); - text: 您不应该使用任何ifelse语句 testString: assert(!/else/g.test(code) || !/if/g.test(code)); - text: 你应该有九个case陈述 testString: assert(code.match(/case/g).length === 9); ```
## Challenge Seed
```js function sequentialSizes(val) { var answer = ""; // Only change code below this line // Only change code above this line return answer; } // Change this value to test sequentialSizes(1); ```
## Solution
```js // solution required ```