(Lesson 4) Syntax Error


#1

Hi everyone,

I get a "SyntaxError: Unexpected keyword 'else' " when i try to run my code.
Said code looks like this:

if (computerChoice < 0.33) {
computerChoice = "rock";
};

else if (computerChoice < 0.66) {
computerChoice = "paper";
};

else
{computerChoice = "scissors";
};

What am i doing wrong?
Thanks for the help!


#2

@voshod,
Do not use a semi-colon-; in an IF ELSE-IF ELSE statement structure...

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

Please read the code-convention
http://javascript.crockford.com/code.html


#3

It worked, thanks a bunch!