Putting in the Logical operators: Error: Invalid left hand assignment!?!?!?


Hi all,

I was wondering if you could tell me whats wrong with my code. I thought it looked right but obviously I'm wrong hahaha. Don't judge me for the variable names :wink:

EDIT: I've figured out the problem :slight_smile:


var user = prompt("Do you want to PUNCH the troll, KISS the troll or just RUN away from the troll").toUpperCase();

    case "PUNCH":
        var strength = prompt("Do you have the strength to knock him out?(YES or NO)").toUpperCase();
        var skill = prompt ("Do you have the skill to evade counters?(YES or NO)").toUpperCase();
        if(stength == "YES" && skill == "YES"){
            console.log("You got him right in the chops");
        }else if(strength = "YES" || skill = "YES"){
            console.log("Well, you might do well, you might not");
            console.log("Urmmm good luck then!");
    case "KISS":
        var sexAppeal = prompt("Do you have the sex appeal for a troll (YES or NO)").toUpperCase();
        if(sexAppeal = "YES"){
            console.log("Go for it, nobody is judging you here");
            console.log("What the heckers you doing");
    case "RUN":
        var training = prompt("Have you been training with Usain Bolt (YES or NO)").toUpperCase();
        if(training = "YES"){
            console.log("You're going to be fine");
            console.log("The troll find and it will lick you");
        console.log("You're just going to stand there.....");


Hi inside all your if statement you should change the = with === also in the else if statement