Number 7, What if choice1 is paper?


#1

I as everybody else get the SyntaxError: Unexpected token else.

Cant figure out the problem, i guess its a bracket missplaced..

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

#2

Remove the ; in each instance. There is no semi-colon in an if-else statement, only inside the code block for each case, as required on statements.

if (condition) {
    console.log("this is a statement that gets a semi-colon");
}

#3

Actually the

`code`

is for inline use for longer blocks better use the </> button or the

```
code
```

About the problem: First of all you have semicolons after conditions, see this for why it is not a good idea:
http://discuss.codecademy.com/t/conditions-blocks-and-semicolons/2176?u=haxor789

And secondly you seem to have structure your else ifs in a way that the else is on the same level as the else if where it should be nested like the if. See the hint to 6/9 for how it should look like.


#4

Oh, now i saw the problem with the brackets. How stupid of me, i've been struggled with this for 3 days now! haha! I guess i know functions and if statements a lot better now. :slightly_smiling: