Exercise 7. unexpected keyword 'else'


#1

can't seem to figure this out.

var compare = function(choice1, choice2) {
    if(choice1 === choice2) {
     return "The result is a tie!";
     } 
    else if (choice1 === "rock") {
      if(choice2 === "paper") {
          return "paper wins";
    } 
}
   else {
   return "scissors wins";
   } 
 else if (choice1 === "paper") {
      if(choice2 === "rock") {
          return "paper wins";
} 
}   else {
     return "scissors wins";
   }
  }

#2

Hi,

You are closing your else if statement before the else you need to close it after the else

Syntax reminder for nesting if/else:

if (condition) {
  //something
}
else if (condition) {
  if (condition) {
    //something 
  } 
  else {
    //somethingelse
  }
}

#3

3 posts were split to a new topic: Exercise 7