Multiple Identical Options in Switch Statements

Multiple Identical Options in Switch Statements
0

#1

Tell us what’s happening:
I’m kinda stuck on this problem. Anyone know what am I doing wrong?

Your code so far

function sequentialSizes(val) {
  var answer = "";
  // Only change code below this line
 switch (val){
    case 1:
    case 2:
    case 3:
      result = "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;  
}

// Change this value to test
sequentialSizes(1);

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0.

Link to the challenge:


#2

You just have an error in the variable name. it’s answer not result


#3

You have made a small mistake, you are assigning a value to a variable ‘result’ which doesn’t exist and you are returning an ‘answer’, which in this case holds an empty string. You can either change the all ‘result’ to ‘answer’ or return ‘result’ although you should declare it first.


#4

Thank you! I got it running!