Computer Choice Part 2: Syntax Error


#1

I am on Computer Choice part 2 and I think I have done something wrong with the conditions on my if/else statments. Is that the problem and if so how do you correctly display a range or is that unnecessary and I should do something else? Thanks!

var userChoice = prompt("Do you choose Rock, Paper or Scissors?");

var computerChoice = Math.random();

if (computerChoice <= 0.34){
return "Rock";
};
else if (computerChoice <= 0.66){
return "Paper";
};
else (computerChoice <= 1){
return "Scissors";
};


#2

Hi try to remove the condition in the esle statement that one (computerChoice <= 1)


#3

Thank you, I tried but it didn't seem to work :confused:


#4

instead of return for the first try to put computerChoice = "rock" make the same for the other return


#5

like that
var userChoice = prompt("Do you choose Rock, Paper or Scissors?");

var computerChoice = Math.random();

if (computerChoice <= 0.34){
computerChoice = "rock" ;
}
else if (computerChoice <= 0.66){
computerChoice = "paper" ;
}
else {
computerChoice = "Scissors";
}