The code cademy is the website(for switch statement);


#1


where is my code problem?

var user = prompt("What is your favorite color ?").toUpperCase();
switch(user) {
case "red":
    console.log("You selected red");
  break;
case "blue":
    console.log("You selected blue");
  break;
case "green":
    console.log("You selected green");
  break;
  default:
    console.log("Your color was not in our cases!!");
}


#2

Hey.

Since you used the toUpperCase() method on your user variable, you need to reflect that in your cases.

i.e "red" should be "RED".


#3

thanks men.i think it works


#4

Make sure to use a break statement with each case!
not work. my error


#5

There is helper?
not


#6

Dont worry :slight_smile: your code is fine.but here in codecademy if want to pass the lesson then remove the word

cases

console.log("Your color was not in our cases!!"); //

#7

realy thanks thanks thanks


#8

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