How can switch code formatting be improved to allow it to run properly and is the help forum not accounting for this?

How can switch code formatting be improved to allow it to run properly and is the help forum not accounting for this?
0

#1

Continuing the discussion from freeCodeCamp Challenge Guide: Multiple Identical Options in Switch Statements:

From Lesson 185
The quote on the original post:

There should not be quotes around the numbers.

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:
answer = “Mid”;
break;
case 7:
case 8:
case 9:
answer = “High”;
}
// Only change code above this line
return answer;
}

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

My post (that looks identical, but will not accept:

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";
              }
  
  
  // Only change code above this line  
  return answer;  
}

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

This is the second time this has happened to me.

Any help would be greatly appreciated.


#2

You are returning answer but inside the switch statement you are setting result.


#3

can you quote the error? I’m really trying to understand you but unable to.


#4

I see now. The reference words needs to be changed.


#5

I had this same problem! How do we get it changed?