Computer Choice Part 2


#1

Hey guys, needing help on Computer Choice Part 2, I have a syntax error but can't find it. Is someone of you guys seeing the problem?

var userChoice = prompt ("Do you choose rock, paper or scissors?")

var computerChoice = Math.random()

if (computerChoice < 0.33) {
    return "Rock";
}
else if (computerChoice > 0.34) { 
    if (computerChoice < 0.67) { 
        return "Paper";
     }
else  {
    return "Scissors";
}

#2

Run it through some other interpreter for a line number, like repl.it
You'll figure it out by just fixing your formatting though


#3

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

This is the code :slight_smile:


#4

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