I am so confused this doesnt make any sense

Tell us what’s happening:
What I don’t understand is the example does not help a beginner understand how to answer the exercise.
Here is an example of a switch statement:

switch(lowercaseLetter) {
  case "a":
    console.log("A");
    break;
  case "b":
    console.log("B");
    break;
}

why does it have console.log there but when I watched the help video he had answer = “alpha”;. Like how was I suppose to know to put that there when the example shows console.log. Also why does it have strings as case and console.log when its numbers for case. So confused this part of the tutorial.

Your code so far


function caseInSwitch(val) {
var answer = "";
// Only change code below this line



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

caseInSwitch(1);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36.

Challenge: Selecting from Many Options with Switch Statements

Link to the challenge:

Hello,

The example shows how switch function can switch a userinput with a preset value. As you can see, if a is an argument for lowercaseletter parameter, A will be printed. In case of b, B will be the output.

The exercise has the same concept. You need to create a function that will pass a number such as 1 and return “alpha”.

1 Like