Help!


#1

I am on level 10 exercise 4 and here is my code PLEASE HELP!!!!!!!!:

switch(user) {
   case 'FIGHT':
    console.log("You fought him");
    break;
case 'PAY':
    console.log("You payed him");
    break;
case 'RUN':
    console.log("You ran by him");
    break;
default:
    console.log("Please enter FIGHT, PAY, or RUN(doesn't have to be upper case)");
}


#2

where is the prompt which you should store in the user variable?

Also, default doesn't have a break


#3

can you please give me the answer i have been working on this for days


#4

No, i can not. The guidelines prevent me. Before your switch statement, you should create a user variable and store the result of the prompt:

var user = prompt()

(you can add text tot the prompt if you want) and just like your case, default should have a break


#5

can you show me the break i need please?


#6

sure:

default:
    console.log("Please enter FIGHT, PAY, or RUN(doesn't have to be upper case)");
    /* missing break */

but it is exactly the same as for the cases?


#7

heres my new code : var user = prompt("So, there is a troll over there and you need to get by to find your long lost treasure. To get by him are you going to FIGHT him, PAY him, or RUN by him.").toUpperCase();

switch(user) {
case 'FIGHT':
console.log("You fought him");
break;
case 'PAY':
console.log("You payed him");
break;
case 'RUN':
console.log("You ran by him");
break;
default:
console.log("Please enter FIGHT, PAY, or RUN(doesn't have to be upper case)");
break;
is this right?


#8

where did the } go to close the switch statement? If it passes, it is good


#9

it doesn't pass :frowning:


#10

wait no i fixed it thanks for the help! your AMAZING!!!!!