5, logical operators, HELP


#1

I was making a "battle simulation" type game and I ran into a problem with the the if/else statements in the end I was wondering if anyone could tell me what I did wrong with the if/else statements. Thank you in advice, CODEBROS2

confirm("You have been sent to the battle of Verdon.");
var user = prompt("You are on a C-130 Hercules, do you just jump, salute and jump, or wait to jump?").toLowerCase();

switch(user) {
case 'jump':
console.log("You pull your parachute on, 3, 2, 1, GO GO GO!!! You jump and you are now skydiving!");
break;
case 'salute and jump':
console.log("There's no time for that, get your butt ready to jump, you go into place and jump out.");
break;
case 'wait to jump':
console.log("Nope, you have to jump, this is war not a game, you jump out on the command of 3, your out!");
break;
default:
console.log("I don't understand you? please try again with: jump, salute and jump, or wait to jump.");
break;
}
if(user === jump && user === salute and jump && user === wait to jump) {
console.log("The winds smacking your face as you jumped, its time, you pull your parachute and wait to reach the ground.")
} else {
console.log("Please restart the game.")
}


#2

Sorry guys, I realized that I didn't put in the ' ' MAJORLY DUMB MISTAKE


#3

Hi @codebros2

  • Delete "break;" after default (because "default :" it doesn't need
    "break;") (line 16)
  • Put string in if condition no jump, you have to write "jump"
  • And to finish replace "&&" to "||" in your "if" condition (because
    it's impossible to have every user == true)

Hold on bro :wink: