What if choice1 is rock?


#1

As for me it''s seems to be right
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";
}
}


#2

Remember to close your functions. The last curly bracket should have a semi-colon attached to it at the end.


#3

Is not that right?

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

};

#4

no as @hleighton mentioned you need to close the function as well or in this case the else if before the function.


#5

But it doesn't work. I don't get it ... -.-


#6

Can't post someone the correct code? :weary:


#7

Hi you need to close your else if statement so your code should be like that

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";
    }
  } <== its was missing that one 
};

#8

@wizmarco thanks!! ! I I had the same problem