function caseInSwitch(val) {
var answer = "";
// Only change code below this line
switch(answer){
case 1:
"alpha";
break;
case 2:
"beta";
break;
case 3:
"gamma";
break;
case 4:
"delta";
break;
default:
break;
}
// Only change code above this line
return answer;
}
// Change this value to test
caseInSwitch(1);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.
Then why does the example for this challenge not use ‘answer=’ ? The example uses ‘console.log()’ instead of ‘answer.’ So why doesn’t it work if I use ‘console.log(“alpha”)’, etc. in my code ? And if that is a completely different function than using ‘answer’ then why is it being used in the example? If it does something different then it is not an example of what your code is supposed to do, is it?
switch(lowercaseLetter) {
case “a”:
console.log(“A”);
break;
case “b”:
console.log(“B”);
break;
}
It just seems like if they want you to do something different than what is in the example then the instructions need to explain that they want you to do something different. Obviously I am new to JavaScript, but that's what these lessons are for, right? Did I miss something?
Ok, thank you. I also looked up what the console.log function was supposed to do. But then why is that in the example ? Did they just happen to use an example of code that does something entirely different than the challenge? It is never explained in the lesson what the console.log in the example accomplishes, so it is a bit of a leap for someone new to coding to understand that I need to use something different to fulfill the challenge. If the purpose and function of the example were explained, or the example were in the same vein as the challenge it would make a lot more sense.