Computer choice:part 2 I don't feel like it is right,Why does it give me a pass?


#1

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 === "papper";
} else {
computerChoice === "scissors";
};


#2

Does this return anything at all? It would seem to be that your Math.Random() will never hit a negative number which is what you're evaluating against in each if statement. You'll need to test a range of numbers rather than subtracting two numbers from eachother, you can do this by using the greater than (>) and less than (<) operators. Also when you're assigning the value, use just 1 equals sign. Try my code below:

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

if (computerChoice >= 0 && computerChoice <= 0.33)
{
    computerChoice = "rock";
}

else if (computerChoice >= 0.34 && computerChoice <= 0.66)
{
    computerChoice = "paper";
}

if (computerChoice >= 0.67 && computerChoice <= 1)
{
    computerChoice = "scissors";
}