My code won't work i need help it keeps saying SyntaxError: Unexpected token else


#1

var userChoice = prompt("Do you choose rock, paper or scissors?");
var computerChoice = Math.random();
if (computerChoice < 0.34) 
computerChoice = "rock";
 else (computerChoice <= 0.67) 
computerChoice = "paper";
else computerChoice = "scissors";
 console log("Computer: " + computerChoice);

var compare = function(choice1 choice2) 
if(choice1 === choice2) 
return "The result is a tie";

#2

him there are lots of questions on that exercises, check them out selecting
4. Build "Rock, Paper, Scissors" topic on JavaScript


#3

You are missing open and closing curly braces { } for you if else statements. Also Your first else should be a else if. Also missing the comma between choice1 and choice2 .


#4

The braces are not the problem the rest is. Well spotted.
Here is a post about the braces:
http://discuss.codecademy.com/t/conditions-blocks-and-semicolons/2176?u=haxor789


#5

@mara15

him there are lots of questions on that exercises, check them out selecting 4. Build "Rock, Paper, Scissors" topic on JavaScript. i dont think that helps much.


#6

ok, pal, thats your point of view. you dont need to express it here, you could have sent me a private message, if you have an opinion about what I say or how I reply posts.

I read other posts and learn by that before asking something.

:sunny: