SyntaxError: Unexpected keyword 'else' i can't understand where is wrong


#1

var compare =function(choice1,choice2){
if(choice1==choice2){
var answ = "The result is a tie!";
}

 else if(choice1==="rock"){
    if(choice2==="scissors"){
        var answ="rock wins";
    }
    else {
        answ="paper wins";
    }
};
else if(choice1==="paper"){
    if(choice2==="rock"){
        var answ="paper wins";
    }
    else {

    answ="scissors wins";
    }
};
return answ;

};


#2

The problem is this semicolon:

 else if(choice1==="rock"){
    if(choice2==="scissors"){
        var answ="rock wins";
    }
    else {
        answ="paper wins";
    }
}; //<--

Here is a longer explanation


#3

thanks a lot!! i'll give it a read!