I have no idea what is wrong in this code


#1


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


Syntax


var userChoice = prompt("Do you choose rock, paper or scissors")
var computerChoice = Math.random();
console.log (computerChoice)

if (0 < computerChoice < 0.33) {
    console.log(rock)
} 
else if (0.34 < computerChoice < 0.66) {
    console.log(paper)
}
else (0.67 < computerChoice){
    console.log (scissors)   
}


#2

if you want to do multiply comparison, you should use a and (&&) or or (||) operator, but you don't have to. You can just check for values less then .34 in your if conditions, lesser then .67 in your else if (don't check the number is bigger then .34, if it would have been smaller if runs, and then else if will never run)

Else can't have a condition at all


#3

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