What is wrong with my code : Rock , Paper , Scissors


#1


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


I get this error code anytime I run my piece of code I need help here
"Oops, try again. There was a problem with your syntax."


var userChoice = prompt("Do you choose rock, paper or scissors?");
var computerChoice = Math.random();
console.log("The value of Math.random in the computer choice variable is :");
console.log(computerChoice);

if(computerChoice >=0&&<=0.33){
    computerChoice="rock";
}else if(computerChoice >=0.34&&<=0.66){
    computerChoice="paper";
}else{
    computerChoice="scissors";
}


#2

(computerChoice >=0&&<=0.33) //wrong

you should write (computerChoice >=0 && computerChoice <=0.33)

but it's unnecessary

you can just write if( computerChoice <=0.33)

else if(computerChoice >=0.34&&<=0.66)  // do same

#3

Aight thanks man @rcodeman


#4

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