I'm stuck... Please help


I'm stuck on this excercise:

This is the error message it's giving me:
SyntaxError: Unexpected token else

This is my code:

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

Please help


The function body is still not closed, Add one more curly brace to the very end,and include a semi-colon on that brace only.



Could you give me an example i dont quite understand where to put the curly bracket


Actually there are two places where a brace is needed.

Should be,

if (choice1 === choice2) {  // note no semi-colon here

and at the end of the code, add };.


Thank you very much :smiley:


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