4. Computer


#1

Error: Oops, try again. There was a problem with your syntax.

Code:

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 >= 0.67 && <= 1) {
    computerChoice = "scissors";
}

#2

if you wanted to use a and operator (&&) (you don't even have to) you would have to do comparison at both side of the and operator:

if (computerChoice >= 0 && computerChoice <= 0.33)

but you don't even need this, if you think it through

Also, else can't have a condition at all (since it is everything else)


#3

Ok, thank you for your response, what other way could i do it?

never mind i got it :slight_smile: