6.what if choice1 is rock? Help me i am so stuck


Help me this is 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";

it replies: Oops, try again. There was a problem with your syntax.


I have found out were I went wrong if anyone wants the correct code this is it:
var compare=function(choice1,choice2) {
if (choice1===choice2){
return "The result is a tie!";
else if (choice1==="rock") {
return "rock wins";
return "paper wins";


You're missing an opening curly brace here.

Also, one more at the end of everything to close things up! :slight_smile:


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