8/9 help


#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";
        }
    } else if(choice1 === "paper") {
        if(choice2 === "rock") {
            return "paper wins";
        } else {
            return "scissors wins";
        }
    } else if(choice1 === "scissors"){
        if(choice2 === "paper") {
            return "scissors wins";
        } else {
            return "rock wins";
        }
    }
}

^thats my code and its saying there is a syntax error. im not sure what is wrong (there is proper indenting normally i i just copy pasted it and the indenting didnt stay)


#2

The only things missing I see for what this lesson calls upon is your call function for the userChoice and the computerChoice.

console.log (compare (userChoice, computerChoice))

But make sure to remember to place in the semicolon after your last bracket before you place in your call function so the console doesn't think it's part of the code.

Other than that the code you wrote looks correct.


#3

I'd agree with @byteblaster66792 your code seems to be correct. Could you post your error message? Have you tried to refresh the page?

PS: you can use 3 backticks ` to format your code try to edit your code to see how it was done.