HELP Basic JavaScript: Selecting from Many Options with Switch Statements

HELP Basic JavaScript: Selecting from Many Options with Switch Statements
0

#1

I can’t get my code to work, can somebody check it and see if there is a human error by me, or is the website just messed up and won’t let me “test” it?

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;  
}

// Change this value to test
caseInSwitch(1);

#2

Your double quotes aren’t actually double quotes.

Use ", which is next to the enter key instead of .


#3

I’ve edited your post for readability. When you enter a code block into the forum, precede it with a line of three backticks and follow it with a line of three backticks to make easier to read. See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.


#4

thank you! tried it! still doesn’t work :frowning:


#5

what’s odd is that i can pass all the other Switch challenges right after it! odd! thanks for your help again!


#6

Can you repost your code after your fix?


#7

i figured it out! After replacing it with the correct double quotation marks it was good.

I just left my old attempts at the bottom!