Problem with syntax - Im a little stuck, help appreciated


#1


or

Hey guys - would love some help. I've compared my code to the correct structure but im still getting the error: "SyntaxError: Unexpected end of input"


var compare = function(choice1, choice2) {
if (choice1 === choice2) {
    return "The result is a tie!";
} 

else if (choice1 === "rock") {
    if (choice2 === "scissors") {
        return "rocks wins";
    } else {
        return "paper wins";
        }
    } // end of rock else if statement

else if (choice1 === "paper") {
    if (choice2 === "rock") {
        return "paper wins";
    } else {
        return "scissors wins";
    } // end of paper else if statement
}; // end of function bracket


#2

That's something the interpreter would say if it reaches end of file while it's still expecting something to finish, like a closing brace/quote etc


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.