7. What if choice1 is paper?


#1


7. What if choice1 is paper?


Now it says: "SyntaxError: Unexpected token '{'. Expected ')' to end a 'if' condition."
What am I doing wrong?


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

here:

else if(choice1 === "paper" {

) is missing to close the else if condition


#4

Thank you! :slight_smile:


#5

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