6. What if choice1 is rock?


#1

Hi, can someone please tell me what I'm doing wrong?
Thank you :slightly_smiling:

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

SyntaxError: Unexpected end of input


#2

Hi you should close your compare function

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";
}
};
}  <== Close the compare function

#3

Please do not post duplicate content. I have deleted the other post.