5. Logical Operators. Syntax? please help


#1


Syntax Error! looking it over and over, probably staring me in the face.
What to do??


var user = prompt("How are we going to get across the blood river? (FIGHT, SNEAK, RUN").toLowerCase();
var smart = true;
var good_Lungs = false;

// 


switch (user) {
    case 'fight':
       var level = prompt("What level are you? (1-150)");
         if(level >= 60) {
             console.log("You got a fighting chance! Good luck!");
         } 
         else {
             console.log("Come back later. Youll get killed out here kid!");
         }
    break;
}                                  

//

     case 'sneak':
         var sneaky = prompt("Do you have the sneak bootsies? (Yes / No)").toLowerCase();
         
         if (sneaky === 'yes'; && smart === true;) {
             console.log("Sliped right by em!");
       }        
         else {
           console.log("Caught & killed!");
              }
    break;
};

//

     case 'run':
         if(good_Lungs === true || smart === true){
            console.log("Good thing you did track in high school! You ran right past em!");
}        
         else {
           console.log("My grandmother is faster than you! ");
}
    break;
    
//    
    
     default:
      console.log("Not an option buddy!")
};


#2

your second and third case should be inside of switch statement.so
remove } from

 else {
             console.log("Come back later. Youll get killed out here kid!");
         }
    break;
}  // remove } from here

and

           else {
           console.log("Caught & killed!");
              }
    break;
};  // remove } from here too

and this line

if (sneaky === 'yes'; && smart === true;) // remove semi-colons( ; )


#3

Success! Thank you codeman!

<3


#4

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