Computer Choice: Part 2 Problem


Does anyone know what is wrong with this code?

The error is : Oops, try again. There was a problem with your syntax.
SyntaxError: Unexpected token if

var userChoice = "yes"
prompt("Do you choose rock, paper or scissors?")

var computerChoice = Math.random();

if (computerChoice <= 0.33) {
    computerChoice = "rock";
esle if (computerChoice <= 66 && computerChoice > 0.33 ) {
    computerChoice = "paper";
else {
    computerChoice = "scissors";


At the else if line you write esle if maybe it's the problem


Then what should I write?!


Write else if instead of esle if , you misspelled else if


As @chaoki said + get rid of the semicolons in your conditional structure:


@chaoki is write, you misspelled the else if . You wrote esle if instead of else if
In addition, try to have a second look on this part:

The variable userChoice should be equal to the answer we get by asking the user "Do you choose rock, paper or scissors?"

You should write your codes like this:

var userChoice = prompt("Do you choose rock, paper or scissors?");

And one more thing, remove the semicolon ( ; ) after your closing curly braces


Thanks all!
The problem was misspelled (esle instead of else) and the semicolons after my closing curly braces.
but it was in lessons that we should put a semicolon after closing curly braces!


In which lessons? Only the functions require semicolons on the curly braces because this statement does:


and function(para){} is just a fancy form of VALUE