SyntaxError: Unexpected token {


var userChoice = prompt("Do you choose rock, paper or scissor?")
var computerChoice = Math.random();
if (computerChoice<0.34) {
computerChoice = "rock";
}else if (computerChoice <=0.67) {
computerChoice = "paper";
}else (computerChoice <=1) {
computerChoice = "scissors";

I'm struggling to find where the unexpected token is.


No condition needed/expected for else.


I see you need a semicolon at the end of line one. Does this help? (I'm struggling with the same error)


Remember that in if else statement, the else does not take a condition as an argument:

if(computerChoice < 0.34){
//do this;
//do that;

Also, I haven't looked at this exercise for awhile so I can't remember if floats would be randomly generated, but remember that if you go <=0.67, the condition will result as true for a number greater than 0.66, such as 0.665. If the random generator is limited by Math.floor, then it should be okay


Afaik anything that roughly goes to 1/3 rock, 1/3 paper and 1/3 scissors is ok. So no need to bother about the second or third digit after the decimal point. And I guess Math.floor isn't a good idea here at all, think about it Math.random generates a random float between 0 and 1 (not included) so Math.floor will floor all of these numbers down to 0.