Question quotes

Tell us what’s happening:
Describe your issue in detail here.
Tell me please why we have tu put the quotes with letters in case “a”, but not with numbers case 1

  **Your code so far**
function caseInSwitch(val) {
let answer = "";
// Only change code below this line
switch (lowercaseLetter) {
  case "a":
    console.log("A");
    break;
  case "b":
    console.log("B");
    break;


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

caseInSwitch(1);
  **Your browser information:**

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

Challenge: Selecting from Many Options with Switch Statements

Link to the challenge:

Your function is not closed properly. When I close it, it’s giving me this error:
ReferenceError: lowercaseLetter is not defined


Can you elaborate your question? Maybe provide some examples?

Not sure if I understand the question but 1 is a number and "1" is a string.

A switch uses strict equality checking so if you are switching on a number your case has to be a number (or you have to convert the type).

The code you have posted looks to be the example code and not the code needed to pass the tests.

Also "a" is a string but a is a variable, so you need the quotes if you want to compare to a string

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.