5. Logical operators help!


#1

var user = prompt ("what you prefer , (warrior , thor or archer?)").toUpperCase();
switch (user) {
case 'sword':
var warrior = prompt ("are you a warrior? ,( YES or NO or WHY NOT)");
if(( warrior=== "YES" || warrior = "WHY NOT")){
console.log("you are a warrior and you get a sword");
}
else{ console.log("you are not a warrior!");
}
break;
case 'hammer':
var thor = prompt (" are you god like thor?");
if((thor === "YES" || thor === "WHY NOT")){

        console.log("you are god like thor and you get a hammer");
    }
    else{
        console.log("you are not thor!");
    }

    break;
case 'arrow':
    var archer = prompt("you know how to fire arrows? so become an archer");
    if (( archer === "YES" && archer=== "NO" || archer==="YES" && archer=== "WHY NOT")){
        console.log("you are archer now , and you get x20   arrows too");
    }
    else{ console.log("you arent archer!");
    }
        break;
default:
        console.log("you dont like anything?");

}


#2

Hi your

var user = prompt ("what you prefer , (warrior , thor or archer?)").toUpperCase();

you .toUpperCase() the input so your case should be write with uppercase like that

...
case 'SWORD':
...
break;
case 'HAMMER':
...
break;

then this line

if(( warrior=== "YES" || warrior = "WHY NOT"))

yous should change the = with ===


#3

thank you! very much!