function caseInSwitch(val) {
var answer = "";
// Only change code below this line
switch (val) {
case 1:
answer="alpha";
preak;
case 2:
answer="beta";
preak;
case 3:
answer="gamma";
preak;
case 4:
answer="delta";
preak;
}
// Only change code above this line
return answer;
}
// Change this value to test
caseInSwitch(3);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36.
It is true that this error was observed and modified
Thanks
But there is a problem with the code that follows
It is as follows ::
…
function switchOfStuff(val) {
var answer = “”;
// Only change code below this line
switch (val) {
case ‘a’:
answer = ‘apple’;
break;
case ‘b’:
answer = ‘bird’;
break;
case ‘c’:
answer = ‘cat’;
break;
default:
answer = ‘stuff’;
break;
}
// Only change code above this line
return answer;
}
Is this a new challenge? It would be better if you open a new topic for it. Also, don’t forget to format your code with three backticks (```) and to post the link to the challenge.
What @ghukahr said, if it’s a completely new challenge it’s easier to start a new topic because you can just hit the “get help” button to create one with a link back to the challenge.
But in this case:
You don’t break after default: there is nothing to break out of — it’s the last, default option, so if none of the other cases match, it’s always that one (whereas with any of the other ones, if the case matches, then you want to stop the switch statement looking at any of the other options immediately)