Something is wrong with my if and else statement


#1


https://www.codecademy.com/courses/javascript-beginner-en-ZA2rb/0/5?curriculum_id=506324b3a7dffd00020bf661#


SyntaxError: expected expression, got keyword 'else'


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

switch(user)
{
        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.");
        }
        else
        {
        console.log("I like both of those.");
        }    
        break;
        
        case 'DESCHUTES':
        console.log ("That is a good brewery.");
        break;
        
        case 'PBR':
        console.log ("You must be from Portland");
        break;
        
        default:
        console.log ("I haven't had that one.");
}

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


#2

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

#3

Thanks! Solved in less than sixty seconds.


#4

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.


#5

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