Unexpected keyword "else"


This is driving me nuts. Is this a bug or am I missing something simple? I refreshed the page and it worked on the previous try, now it does't.

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


It has something to do with the "else if" statement


Remove the semicolon before your else if. It's ending your compare function before all the code necessary.


I tried that already. I went all the way back and completely re-entered the code 3 times. Still not working


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