5. Logical Operators - Help with Code/ Syntax Error!


#1


Help! Losing sleep :frowning:

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


Code is producing a Syntax Error:
"SyntaxError: missing ( before condition"


var user = prompt("Are you prepared for the journey that lies ahead?").toUpperCase();

var strength = prompt("On a scale from 1-5 how much strength do you possess?").toUpperCase();

var magic = prompt("On a scale from 1-5 how much magic do you possess?").toUpperCase();

switch(user){
    case 'YES':
        if(strength<=3 && magic<=3){
        console.log("I'm afraid you are too weak to survive this realm, remain home and continue training with your mother!");
        }
        if else(strength>=4 || magic>=4){
        console.log("You are ready, but expect to rely heavily on your stronger hand of two!");
        }
        else{
        console.log("You are more than prepared for this adventure, bring both of thy talents!");
        }
        break;
    case 'NO': 
        console.log("I Could smell the cowardice upon you!");
        break;
    case 'MAYBE':
        console.log("I Have faith in you!");
        break;
    default: 
        console.log("Choose again, the universe doesn't have time for intermediates!");
}


#2

Here:

It should be else if and not if else.

I hope this helps! :wink:


#3

Dude you rock!!! It worked like a charm. Thank you!


#4

You're welcome man!

Have fun coding! :smile:


#5

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