Getting : SyntaxError: Unexpected token ILLEGAL!


#1

What if Choice 1 is Rock?

It says "SyntaxError: Unexpected token ILLEGAL" in the browser to the right, and after I hit submit, I get a "There was a problem with your syntax" below...

Could anyone help me out with fixing this code? Thank you so much!


var compare = function(choice1, computerChoice) {
    if (choice1 === computerChoice) {
        return "The result is a tie!";
    }
    
    else if (choice1 === "rock") {
        if (computerChoice === "scissors) {
            return "Rock wins!";
    }
    
    else {
        return "Paper wins!";
    }
} ;


#2

Hi
you forgot the closing " for scissors in if (computerChoice === "scissors) {


#3

Thank you so much! Er... I'm getting an "Unexpected end of input" error now.

Could you please help again?


#4

Thank you thebelegian1! It seems that I missed a } at the end.


#5

#6

#7

This topic was automatically closed after 24 hours. New replies are no longer allowed.