Adding IF/Else to Swich Staement


I'm getting an unexpected token error.

var user = prompt("Do you have money?").toUpperCase();

    case 'YES':
        console.log("Can I have some?");
    case 'NO':
        console.log("I don't believe you.");
        if(case === 'YES' && case === 'NO'){
            console.log("Well...which is it?");
        else if(case === "YES" || case === "MAYBE"){
            console.log("I think you mean Yes.");
            console.log("Whatever, this is a stick up.");
    case 'MAYBE':
        console.log("Give me your money.");
        console.log("I asked you a question.");


using case inside a if or else if statement is a bad idea. I would compare with the user variable:

user === "YES"

since use holds the string with what the entered, not case.


The assignment is to put an if/else into the case. I can't advance to the next lesson.


Oh I can use any conditional in that if/else? You don't have to use the case?


yea, you put the if/if else/else statement inside of the case, but then inside your if statement (in the condition) you shouldn't use case, you should use user, which is the variable that holds what the user entered