ComputerChoice only defines rock


#1

i cant get the computer to define paper and scissors when the randomized number is above 0.33 it gives the error: ReferenceError: comptuerChoice is not defined

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

if (computerChoice >0 && computerChoice <=0.33) {
console.log ("rock");
}
else if (comptuerChoice >0.33 && computerChoice <=0.66) {
console.log ("paper");
}
else if (comptuerChoice >0.66 && computerChoice <=1) {
console.log ("scissors");
}


#2

check your spelling

else if (comptuerChoice >0.33 && computerChoice <=0.66) { // you've wrote comptuer instead of computer
console.log ("paper");
}
else if (comptuerChoice >0.66 && computerChoice <=1) {
console.log ("scissors");
}


#3

thank you very much!


#4

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