5. Logical operators


#1

I don't know what I'm doing wrong, it keeps saying Illegal break statement.
please help!
here is my code

var user = prompt("You are being chased by a zombie and got cornered! Do you FIGHT him, PAY him, or           RUN?").toUpperCase();

switch(user){
case 'FIGHT':
var Strong = prompt("Are you strong?","Yes or No?").toUpperCase();
var Smart = prompt("Are you smart?","Yes or No?").toUpperCase();

if(Strong || smart) {
        console.log("You found a wooden bat and you beat up the zombie and you lived to see another day! you needed to be smart or strong to do it!");
    }else{
        console.log("You couldnt do anything, the zombie ate your brain");
    }
break;

case 'PAY':
  var Money = prompt("Do you have money?","Yes or No?").toUpperCase();
  var Amount = prompt("How much do you have?","Amount?")

if(Money === "YES") {
    if(Amount > 5){
        console.log("You bribed the zombie with " + Amount + " and you both live happily ever after!");
    }else{
        console.log("You couldnt bribe him with " + Amount + ", so the zombie ate your brain!");
    }
}else{
    console.log("Too bad, the zombie ate your brain");
}
}

break;

 case 'RUN':
    ("You were cornered so you couldn't run! The zombie ate your brain because of un-smart decision")
  break;
default:
    console.log("That's not an option! The zombie ate your brain!")
}

#2

@digitalcoder19693,
-1
variable names are all starting with =lowercase
( with the exception when you naming a Object-Class-constructor )
http://javascript.crockford.com/code.html

-2
If you use a string Value at the position where Javascript expects a Boolean Value
Javascript will do an internal convert to a truthy Value
https://developer.mozilla.org/en-US/docs/Glossary/Truthy
https://developer.mozilla.org/en-US/docs/Glossary/Falsy

-3
In your code you use 1 closing-curly-bracket-} to many
and therewith closing the switch statement to early

var user = prompt("You are being chased by a zombie and got cornered!"+
                  " Do you FIGHT him, PAY him, or           RUN?").toUpperCase();

switch(user){
    case 'FIGHT':
        var Strong = prompt("Are you strong?","Yes or No?").toUpperCase();
        var Smart = prompt("Are you smart?","Yes or No?").toUpperCase();

        if(Strong || smart) {
              console.log("You found a wooden bat and you beat up the zombie "+
              "and you lived to see another day! you needed to be smart or strong to do it!");
        }else{
              console.log("You couldnt do anything, the zombie ate your brain");
        }
        break;

case 'PAY':
     var Money = prompt("Do you have money?","Yes or No?").toUpperCase();
     var Amount = prompt("How much do you have?","Amount?")

     if(Money === "YES") {
           if(Amount > 5){
                   console.log("You bribed the zombie with " + Amount +
                  " and you both live happily ever after!");
           }else{
                  console.log("You couldnt bribe him with " + Amount + 
                   ", so the zombie ate your brain!");
           }
     }
     else{
            console.log("Too bad, the zombie ate your brain");
     }
}

and therefor the following break statement is NOT expected by the Javascript interpreter.


#3

Thanks for the help!