7/9 need some help please!


#1
var compare = function(choice1, choice2){
    if(choice1 === choice2){
        return ("The result is a tie!");
    };
    
    else if(choise1 === "rock"){
        
        if(choice2 === "scissors");{
            return ("rock wins");
        }
        else{
            return("paper wins");
        }
    };
    else if(choise1 === "paper"){
        
        if(choice2 === "rock"){
            return ("paper wins");
        }
        else{
            return("scissors wins");
        }
    };
};

Everthing worked fine till here, I now get the message: 'SyntaxError: unexpected token else'

I already read some of the other topics, but still cant figure it out. Anyone knows what I'm doing wrong here?

Thanks


#2

@gigasurfer07584,

The semi-colon-; is interpreted by the Javascript-Interpreter
as an End-of-Statement indicator....

As you are using a semi-colon-; right after
the closing-curly-bracket-} with which you close the code-block of your first-IF statement-part
the rest of the IF ELSE-IF statement structure is NOT seen as an integral part of the IF-statement-part.

You should NOT use the semi-colon-; on any part of the IF ELSE-IF statement structure.

Please read
http://www.codecademy.com/forum_questions/559dcb4be39efe550f00006b
concentrating on

  • the build of the IF ELSE-IF statement structure

and take a look at the usage of choise vs choice......


#3

That did it!

Thanks!