7/9 Proof Read


#1

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

I'm not sure why it isn't working. Can anyone lend a helping hand? xoxo

Error is unexpected token else.


#2

No semicolons after conditions here:

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

wrap the following if else in {} instead as you did it for the paper case.

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

this semicolon is completely redundant and you lack a } for the compare function to be closed.

Here is something to read about semicoloncs and conditions:
https://www.codecademy.com/forum_questions/52373a75548c3515940000dc#answer-529fa36052f863bb58000338
And here is something about the idea of RPS:
https://www.codecademy.com/forum_questions/51fc4178f10c60f4eb001233#answer-54917bd395e378bc1f001cf4


#3

Thanks a million Haxor! I've seen your other posts, thanks for helping the community xoxo