Build "Rock, Paper, Scissors"


#1

This is the code:

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

Error : Oops, try again. Did you set var computerChoice = Math.random() ? The capital 'M' in 'Math' is important!
What is the proble?


#2

you have to much code in the exercise, your if/else if/else block then overwrite the random number stored in computerChoice with rock, paper or scissors, which you shouldn't do (not yet). Comment out the if/else if/else code block


#3

what is too much


#4

i already mentioned what is too much? Okay, everything from line 4 and on-wards is too much, that is for exercise 4. computer Choice Part 2


#5

Sorry, i have error at computer Choice Part 1


#6

Error: "Oops, try again. Did you set var computerChoice = Math.random() ? The capital 'M' in 'Math' is important!"


#7

yea, and the error is caused by running ahead of the exercise, like i explained already you have to much code, removing line 4 till the end of file