Math.random() doesn't mean anything to my computerChoice


#1

Version 1:

Logic says the system must exit the if-else loop once the condition is met and execute the instruction outside the loop. Still, computerChoice always reflects 'Scissors'.

Version 2:

As the above code treated each no. less than 1 so I tried another version, still get the same result. Help plz...

//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.33 && computerChoice <= 0.66)
{
computerChoice = "paper"
}
else (computerChoice > 0.66 && computerChoice <= 1)
{
computerChoice = "scissors";
}

console.log(computerChoice);


#2

Stop putting conditions on your else statements then do your testing again.