7. what if choice1 is paper


#1

I am very confused.
the code that it starts with has the else if statement outside of the if statement.
So this is how it starts:

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"
        }
    }
};

So do we have to move this else if statement into the original if statement?
Or why is the code in the orginal question wrong.

help. please.


7. what if choice1 is paper?
7. what if choice1 is paper?
#2

your code is fine? cwatt1517h didn't nest his else statement inside his else if statement


#3

So now I still get SyntaxError: Unexpected token else
Here is my code

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!"
        }
    }
};

Have retried a million ways and just cant seem to get it


#4

i am not paying attention:

else if (choice1 === "rock"); {

there is a semi-colon in this line, which interrupts the else if clause. remove the semi-colon


#5

HALLELUJAH! thank you so much. It was killing me.


#6