I am creating a game of Rock, Paper, scissors on "Codecademy" so I am using simple JavaScript for this. There are four necessities for this simple code
- If computerChoice is between 0 and 0.33, make computerChoice equal to "rock".
- If computerChoice is between 0.34 and 0.66, make computerChoice equal to "paper".
- If computerChoice is between 0.67 and 1, make computerChoice equal to "scissors".
- Needs to be an If/Else If/Else statement
So basically, I need to change the value of the function "computerChoice" based on the value of the function "computerChoice".
var userChoice = prompt("Do you choose rock, paper or scissors?");
var computerChoice = Math.random(); {
console.log(computerChoice);
}
if (computerChoice >= 0 & <= 0.33) {
computerChoice = rock;
}
else if (computerChoice >= 0.34 & < 0.66) {
computerChoice = paper;
}
else {
computerChoice = scissors;
}