I feel stuck on the switch statements challenge , i feel something isnt proper on the question… is this jus me
The question should be fine. If you post your code and a link to the challenge you are working on, then we should be able to help you figure out what’s going on.
function caseInSwitch(val) {
var answer = "";
// Only change code below this line
switch(val) {
case 1:
console.log("alpha");
break;
case 2:
console.log("beta");
break;
case 3:
console.log("gamma");
break;
case 4:
console.log("delta");
break;
}
// Only change code above this line
return answer;
}
caseInSwitch(1);
this was my solution , although not 100% confident
It looks good to me.
I thought so too, but it wont pass . Here’s the link to the challenge
For most of the challenges, when you are using a function, you need to replace the console.log with a similar statement.
1 Like
The instructions want you to
and sets
answerfor the following conditions:
You are console.log()ing the result. You have the right result from the switch, but you are doing the wrong thing with the result.
1 Like
it worked, thanks
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;
}
caseInSwitch(1);