Something is wrong with my if and else statement


SyntaxError: expected expression, got keyword 'else'

var user = prompt("What is your favorite brewery?").toUpperCase();

        case 'BRIDGEPORT':
        var ipa = prompt ("Do you like their IPA, YES or NO?").toUpperCase();
        var blueHeron = prompt ("Do you like their Blue Heron, YES or NO?").toUpperCase();
       if(ipa === 'YES' && blueHeron === 'YES');
        console.log ("Those are my favorites too.");
        console.log("I like both of those.");
        case 'DESCHUTES':
        console.log ("That is a good brewery.");
        case 'PBR':
        console.log ("You must be from Portland");
        console.log ("I haven't had that one.");

Not sure what is wrong with my if and else statement. Appreciate the help.


if(ipa === 'YES' && blueHeron === 'YES'); // remove ;


Thanks! Solved in less than sixty seconds.


But if you're sure that's where the problem is, or at least have reason to suspect it, then you can have a look at a reference for how to do them. Google mdn if-statement or for just about any other resource

You can also experiment with it in a more minimal example so that you are able to tell that the rest of the code isn't interfering.


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