Cant find the syntax error


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


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".


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