Still need help... rock,paper, scissors

Need best advice because im still stuck and i may needs some help with curly brace

heres 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 (choice2 === “paper”) {
if (choice2 === “rock”) {
return “rock wins”;
}
else {
return “paper wins”;
}
}
else if (choice2 === “paper”) {
if (choice2 === “rock”) {

}
else {
    return "scissors wins";
}

}

compare(userChoice, computerChoice);

Have you made sure that all of your curly braces match up with their corresponding code? One is missing.

whats missing because its keep saying got ‘}’

is this the problem

return “paper wins”;

your function:

var compare = function(choice1, choice2) {

doesn’t have a matching closing curly bracket (})

Hmm, I see some other issues. Take a look at your syntax here:

Also, check your else ifs. They should have choice1s instead of choice2s.

@biff75 and @stetim94 can you please break it down

also @stetim94 i tried your example, it worked for my past code

If you need more help, please post an updated version of your code

what does that mean, change it

Here’s my different code, i tried:

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

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

compare(userChoice, computerChoice));
else {return "rock wins";}
// missing a } here to end your compare function

compare(userChoice, computerChoice));  // extra ) here

did it work for you, it did not work for me

@albionsrefuge was it hard to do this

It would be helpful if you posted all of your updated code instead of just a few lines.

Okay

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";
    }
    }
    else if(choice1 === "scissors") {
        if(choice2 === "rock") {
    return "rock wins";
    }
    else {
        return "scissors wins";
        compare (userChoice, computerChoice);

it still gives the same error

I’ve tidied up your code which is something that you should get used to doing because it makes it a lot easier to spot missing { }, ( ) , ; , etc.

I’ve left you comments where there is either something to be removed or something to be added.

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

compare(userChoice, computerChoice);

what am i supposed to do here
// missing } to close else
// missing } to close else if
// missing } to close compare function