Variable not changing to string


computer choice part 2

my computerChoice variable is not changing to the string associated with the random number

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


if(computerChoice < 0.33){
    computerChoice === 'rock';}
    else if(computerChoice < 0.66){
        computerChoice === "scissors";}
            computerChoice === 'paper';}



Can you include the link to this lesson, or the name of it?



I should've seen your problem earlier.

You are comparing if computerChoice is equal to rock scissors and paper rather than setting it equal to them after your if, else if, and else statements. Also, Why are your else if and else statements indented? They should be in line with your if statement.


Hi Thanks for the help. I was using strictly equals rather than the assignment operator


Yeah, no problem! Did you get passed the lesson?


yea .... all good. Thanks!!


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.