What is wrong in my code?


#1



Hi guys!
I don't know what is wrong with my code,"There was a problem with your syntax." that is the message.
code:
if(choice1 === choice2) {
        return "The result is a tie";
    }
    else if(choice1 === "rock"){
        if(choice2 === "scissors") {
        return "rock wins";
    } 
    else {
        return "paper wins";
    }
}


#2

Not sure, but maybe you forgot to give it a function:

var compare = function (choice1, choice2) {


#3

if you did include the function line at the top of this block of code right before the first if statement, like this:

var compare = function (choice1, choice2) {
if(choice1 === choice2) {

make sure you close it at the bottom with a closing curly brace }

you have to debug, it says "there is something wrong with your syntax" normally it means you haven't closed a brace or something


#4

Thanks guys, you were right, I forgot to close a brace.