Whats wrong


#1

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


#2

you should check for numbers lower or equal to .33, if so, make computerChoice rock. then with elseif, check for numbers lower or equal to .66,

else can't have a condition at all, since it is everything else


#3

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


#4

it works now?


#5

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