You shouldn’t have four breaks no break after the last one

Continuing the discussion from freeCodeCamp Challenge Guide: Selecting from many options with Switch Statements:

1 Like

Hi, run the code again, all seems right except the starting commas(")
use the second approach and try this one

function caseInSwitch(val) {

var answer = “”;

// Only change code below this line

switch (val) {

case 1:

answer = “alpha”;

break;

case 2:

answer = “beta”;

break;

case 3:

answer = “gamma”;

break;

case 4:

answer = “delta”;

break;

}

// Only change code above this line

return answer;

}

function caseInSwitch(answer) {
// Only change code below this line
switch (answer){
case 1:
answer = “alpha”;
break;
case 2:
answer = “beta”;
break;
case 3:
answer = “gamma”;
break;
case 4:
answer = “delta”;
}

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

caseInSwitch(1);

That’s how it worked for me and I think that’s how it’s supposed to look like.