Im trying to get to part 8, but my syntax is incorrect. HELP!


#1


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


#2

Second closing brace is missing to close the else if.


#3

Do you mind writing the code so I can see my mistake? please.


#4

Nvm thank you, I got it.


#5

It will help if you give closing braces their own line. That way you can see the structure more easily.

if ( ) {

}
else if ( ) {
  if ( ) {

  } else {

  }
}

#6

Thank you so much, this helped a lot.


#7

A post was split to a new topic: Doesnt seem to work


#8