4/9 output is the random number instead of rock/paper/scissors


#1

For some reason, computerChoice is not returning as rock, paper, or scissors. Instead it is printing the random number.

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

if (computerChoice >= 0 && computerChoice <= 0.90) {
computerChoice === "rock";
} else if (computerChoice > 0.33 && computerChoice <= 0.66) {
computerChoice === "paper";
} else {
computerChoice === "scissors";
}

console.log("Computer throws:" + computerChoice);

//Output: Computer throws 0.4874428 etc.


#2

It seems that it was an issue with the "===" . I removed the extra two and it works correctly now.


#3

Yes === is a comparison operator whereas = is the expected assignment operator.