I am using codecademy courses and I'm learning how to make a rock paper scissors game out of randomizing numbers. It says I've done a "good job" but every time I try to properly get each one to properly show up to their respective conditions it messes up.
Please leave a comment pinpointing the error and tips on avoiding it in the future.
Conditions - 0 to .33 = Rock -.34 to .66 = Paper -.67 to 1 = Scissors
JS Code
var userChoice = prompt("Rock, Paper, or Scissors?");
var computerChoice = Math.random();
console.log(computerChoice);
if (computerChoice <= 0.33) {
console.log("Rock");
}
else if (0.34 < computerChoice < 0.66) {
console.log("Paper");
}
else {
console.log("Scissors");
}
Aucun commentaire:
Enregistrer un commentaire