Help Computer Choice Part 2 on Build Rock Paper Scissors


#1

What's wrong?
var userChoice = prompt("Do you choose rock, paper or scissors?")
var computerChoice = Math.random();
console.log(computerChoice)
if (computerChoice < .33) {
computerChoice="rock"
};
else if (computerChoice < .66) {
computerChoice="paper"
};
else {
computerChoice="scissors"
};


#2

Hi you should remove all the ; after the }..


#3

this my code but i am spanish computadoraElige == computerChoice
var usuarioElige = prompt("┬┐Piedra=1, papel=2 o tijera=3?");

computadoraElige = Math.random()
console.log(computadoraElige);
if (computadoraElige >= 0 && computadoraElige <= .33){
computadoraElige = "piedra"
}
else if (computadoraElige >=.33 && computadoraElige <= .66){
computadoraElige = "papel"
}
else if (computadoraElige >=.66 &&
computadoraElige <= 1){
computadoraElige = "tijera"
}


#4

here's my code that works. feel free to copy and paste.

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


#5

Here's what you should do:
-get rid of the var on line 2
-you should replace "<.33" with "<.34"
-you need a ; on lines 5, 8 and 11
-no semicolon on all your }
-for your else if statement, you should replace '<' with '>'
-you mixed up "paper" and "scissors for your if/else if/else statement, so
put "scissors" where "paper" is and vice versa.

This should work. if not, tell me :slight_smile: