Paper, Scissors, Rock


#1

I have copied the code from the Hint and it says there is a synax error.

function compare(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";
    }

}

Am I missing something here or is the code wrong?
Thanx for your help.


#2

Seems like your missing a } to close the function. Hint: You can see those thing much better if you indent your code appropriate:

function compare(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";
         }
    }
} //  and this one was missing

#3

Omg! :expressionless: Thanx!