Can someone please tell me what is wrong with my code (rock papers scissors)


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


#2

i don't see anything wrong with the actual code but it might be a problem with the instructions. what does the error say?


#3

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


#4

oh the first return has parenthesis and it doesn't need that, only console.log has ()


#5

Thank you for that,but it still doesn't work.
Apparently there is still an issue with my syntax. SyntaxError: Unexpected end of script


#6

can you send me a link?


#7

you didn't close your function

and it is recommended that remove the ; after }


#8

Thanks that fixed it!


#9

Thanks for your help!! All fixed now


#10

actually it looks like the 2nd if statement isn't closed.


#11

no problem, anytime.


#12