Rock paper scissors problem


#1


https://www.codecademy.com/courses/javascript-beginner-en-Bthev-mskY8/0/4?curriculum_id=506324b3a7dffd00020bf661#


i am stuck here it gives syntax error


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


#2

HI the else statement doesn't take any condition so remove it here

else (computerChoice>0.66){
    computerChoice="scissors";
}

if (condition){

}
else if (condition) {

}
else {

}

#3


I am having the problem of errors and I don't know what I did wrong.
need a little of help.


#4

Hi remove all the ; you put after the closing } of your if, else if and else stastement


#5

Thank you.Now its working


#6

It appears the conditions are incorrect. Since all possibilities are contained in the "rock" and "paper" parts, you will never get "scissors." Although I didn't get mine to work yet, mine says:

if (computerChoice <= .33) {
computerChoice = "rock";
} else if (computer Choice <=.66) {
computerChoice = "paper";
} else {
computerChoice = "scissors";
}


#7

It worked to many of the ( ';'). Thanks for the help.


#9

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