4. swtich case


#1

What is wrong with my syntax? can someone please help?????!

var user = prompt("You encounter the almighty ODEYISH in the forest!! Do you FIGHT her, PAY her or RUN away from her?").toUpperCase();

Switch(user){

 case 'FIGHT':
   var answer1 =  prompt("Are you strong enough? I wouldn't overrate yourself, this woman is a beast!!!", "YES or NO").toUpperCase();
    
    if(answer1 = 'YES'){
        console.log("well good luck then...you might need it");
    }else{
        console.log("yes that what I thought...");   
    }
    break;



case 'PAY':
    var answer2 = prompt("how much money do you have?", "don't include '$'");
    if(answer2 < 200){
        console.log("sorry, you don't have enough money, She will swallow you alive");
    }else{
        console.log("give me the rest! stop hiding it!");    
    }
    break;
    
    
case 'RUN':
    console.log("That's right! You better run!!!!!");
    break;
    
    
default:
    console.log("You, couldn't just follow the simple directions..");
}

What is wrong with my syntax? can someone please help?


#2

@blogsolver70882,

In
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch
and
comparison operator
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators