Q4 syntax error


#1



I cant figure out how to make this work. just get syntax error,


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


#2

the if's should not have returns, because this is not a function? IDK
they should be computerchoice


#3

No question mark required, you seem to know. :slight_smile:


#4

Ik this was marked as solved, but you are also missing on other thing; right above the if statement, then you are missing something very important. You know that you are suppose to set computerChoice = whatever in your if statement, but how are you going to make the user see what the computer is logging?


#5

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