Help with 4/9


#1

Can anyone tell me what is incorrect here?

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


#2

I would like to say that at this stage you should know when to use: the parentheses "}"

I would like to show you the example which was really simple for me:

var age = 16;
if (age < 16) {
   alert("You can not drive");
} else if (age === 16) {
   alert("You can almost drive");
} else {
   alert("You are probably a driver!");
}

Here is the answer:

var userChoice = prompt("Do you choose rock,paper or scissors?");
var computerChoice = Math.random();

if (computerChoice <= 0.33 && computerChoice >= 0) {
    computerChoice = "rock";
} else if (computerChoice <= 0.66 && computerChoice >= 0.34) {
    computerChoice = "paper";
} else {
   computerChoice = "scissors";
}
console.log("Computer: " + computerChoice);

#3

You are correct, I should be more attentive with the parentheses. Thank you for showing me the example.


#4

Also the task is not to console.log e.g. "rock", "paper" or "scissors" but to reassign one of these values to computerChoice so for example:

if (computerChoice <= 0.33){
    computerChoice = "rock";
}...