Plz help


#1


i dont see whats wrong with my code, the error says its a syntax error.


var userChoice = prompt("Do you choose rock, paper or scissors?");
var computerChoice = Math.random()
if (computerChoice < 0.34) {
    computerChoice "rock";
    } else if (computerChoice >= 0.67) {
        computerChoice = "paper";
    } else {
        computerChoice = "scissors";
    }


#2

Hi @solar33,

If it may help please see the code example below.
In short you were missing the assignment operator for setting the value to "rock"

var userChoice = prompt("Do you choose rock, paper or scissors?");
var computerChoice = Math.random()
if (computerChoice < 0.34) 
{
    computerChoice = "rock"; //missing the assignment operator
} 
else if (computerChoice >= 0.67) 
{
        computerChoice = "paper";
} 
else 
{
        computerChoice = "scissors";
}

#3

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