6/9 Unexpected end of script


Hi, I have looked over it multiple times and can't work out where I went wrong. All I get is SyntaxError: Unexpected end of script. Any ideas?

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";


It took me a long time to figure this out, but unusually you need to add another bracket at the end. One from the function, one from the "else if" statement, and another from the "else" statement. It looks like you have a bracket hidden somewhere, but it doesn't.

Solution: add another bracket at the end.

Hope it helped! :smiley:


Huh! Strange! I thought I had the brackets covered! I put and extra one in and it worked perfectly.