Logical Operators Help Please


My error says:

'Syntax error: missing ) after condition'

I don't see where I need to place another )

Any help is much appreciated

var user = prompt("You have three wishes.").toUpperCase();

switch(user) {
    case 'fly' :
        if(fly && flying) {
            console.log("You can fly");
        } else {
            console.log("Keep trying");
        console.log("You can fly anywhere your heart desires");
    case 'mind read' :
        if(mind reader || read minds) {
            console.log("You are a mind reader");
        } else {
            console.log("Keep trying");
        console.log("You can read people's minds");
    case 'pizza' :
        console.log("You can turn any Republican into a pizza with no cheese");
        console.log("Choose either fly, mind read, or pizza");


First of all, you still need to add a break in your default case. On top of that, if( mind reader || read minds) doesn't mean anything. Those are not variables, they're not strings. Even if they were stings, they wouldn't be checking if they were equal to anything.


opphh, brain fart. You're right! I completely forgot to set variables for my conditions. Thank you so much for your help!


:joy: I think I snort/chortled loud enough to disturb my cube neighbor


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