Problem with Multiple Identical Options in Switch Statements

Tell us what’s happening:

Seems like I did everything okay but, it doesn’t pass
It goes wrong after the 3rd line maybe i did’t break it properly?

Your code so far


function sequentialSizes(val) {
var answer = "";
// Only change code below this line
switch (val){
case 1:
case 2:
case 3:
answer = "Low";
break;
case 4:
case 5:
case 6:
result = "Mid";
break;
case 7:
case 8:
case 9:
result = "High";
break;
}


// Only change code above this line
return answer;
}

sequentialSizes(1);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36.

Challenge: Multiple Identical Options in Switch Statements

Link to the challenge:

Take a closer look at the specific output your function gives, when answer is different fro the expected, it should clear things up. i.e. console.log(sequentialSizes(5));

It tells me it get’s wrong after
sequentialSizes(3
but not why

Without pressing “Run the Tests” button add
console.log(sequentialSizes(5));
at the end of your code, you will get more insight what is wrong.

1 Like

where did you define result?

1 Like