#4 Switch - My code looks right but only default works


Can someone take a look for me please? My code looks right but only the default outcome works. I am passing the lesson but want to ensure that the rest of the exercise will work if my switch statement is not truly working properly.

Thank you!

var user = prompt("What's your name?").toUpperCase();

switch(user) {
case 'Dany':
console.log("Pretty name!");
case 'Ming':
console.log("Is that your dog's name?");
case 'Ian':
console.log("My fave!");
console.log("How do you spell it?");


I tried to switch it to make for a better "Code your adventure" in the next part of the exercise and now only the first option works? I did setup the first case and then copy and past the next two and the default. Could that have any effect on it?

var user = prompt("Where do you want to go? Jamaica, France or China?").toUpperCase();

switch(user) {
case 'Jamaica':
console.log("Sunshine, here I come!");
case 'France':
console.log("Welcome to France!");
case 'China':
console.log("Don't forget to buy souvenirs");
console.log("Where do you want to go?");


You are converting whatever the user types in to uppercase. eg

#I type in              :=> jamaica
#what is stored in user :=> JAMAICA

You need to be checking the uppercase forms of all the cases you want to check


To be clear:

I should have typed JAMAICA, FRANCE or CHINA in the prompt to tell the program what to convert uppercase?


No, I think what rydan meant was: You should check for JAMAICA, FRANCE and CHINA in your switch code,
e.g. case 'JAMAICA': etc.
This is because the input to the prompt is converted to uppercase letters before the code continues to the switch part.

Hope this helps?


It does
thank you!
I went back and played with it.