"Rock, Paper, Scissors". Part 2


#1

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

I kept testing and re-testing the code. Even if a number (say 0.41) comes up, it registers as scissors. Help pls. Thanks!


 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")
}
if (0.67<= computerChoice <= 1){
    console.log("scissors")
}


#2

Check the instructions against your code. You have written an if/else if/if code block. The exercise is asking for an if/ else if/ else code block. Make the necessary change.


#3

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