Computer bypassing my 'else' loop


#1



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


Hey,

I know I still have to add some && operators to this formula, but I am still a little stuck with what I have so far and why my code is behaving in a certain way.

Here's what I have so far:

var question = prompt("Do you like Resident Evil games?").toUpperCase();

switch (question) {
    case 'YES':
        var which = prompt("Which one is your fave?").toUpperCase();
            if (which === "RESIDENT EVIL 4" || "RESIDENT EVIL 1") {
                console.log("Ahh fine taste!");
            } 
            else {
                    console.log("Great game!");    
                }
    break;
    default:
        console.log("That's a shame");
};

However, regardless of what I input to the second question ('which'), the 'if' loop is always the one that runs and never the else. I.e I could put "Grand Theft Auto" as the response to 'which' and it would still run the 'if' loop I have here.

Help!


#2

strings are considered true. If you use a or operator you should compare at both sides of the or operator:

if (which === "RESIDENT EVIL 4" || which === "RESIDENT EVIL 1")