Cant find the syntax error


#1

var userChoice=prompt("Do you choose rock, paper or scissors?");
var computerChoice=Math.random();
console.log(computerChoice);
if(computerChoice>=0 && computerChoice<0.33){
computerChoice="rock";
}
else if(computerChoice>=0.34 && computerChoice<0.66){
computerChoice="paper";
}
else (computerChoice>=0.67 && computerChoice<1){
computerChoice="scissors";
}


#2

Else statements don't take a condition. They execute when prior if/else if statements don't execute. You just need to remove the condition since the first if statement covers values from 0 through 0.33 and the else if covers values from 0.34 through 0.65. What's left? Anything over 0.66 through 1 is assigned "scissors".


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.