What if choice 1 is paper?


#1


https://www.codecademy.com/courses/javascript-beginner-en-Bthev-mskY8/1/3?curriculum_id=506324b3a7dffd00020bf661


I am unsure as to what is wrong with my code, i keep receiving syntax error. All help is much appreciated!


var compare = function(choice1, choice2) {
    if (choice1 === choice2) {
        return "The result is a tie!";
    }
    
    else if (choice1 === "Rock") {
        if (choice2 === "scissors")
    }
        return "Rock wins";
    }
    
    else {
        return "paper wins";
    }
    
    else if (choice1 === "paper") {
        if (choice2 === "rock") {
            return "paper wins";
        }
        
        else {
            return "scissors wins";
        }
    }
};


#2

Fix this:

To this:

else if (choice1 === "Rock") {
        if (choice2 === "scissors")
        return "Rock wins";
}

#3

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