Fixed 4/9 and it's still broken but telling me it's good

var userChoice = prompt ("Do you choose rock, paper or scissors?");
var computerChoice = Math.random();
    if (computerChoice<.33 && computerChoice>0)
    else if(computerChoice<.66 && computerChoice>=.33)
    else(computerChoice>=.66 && computerChoice<1)

Scissors every time


This is my code:

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 = "paper";
    computerChoice = "scissors";

To say the truth, I have no idea what you did there, for I do not know what && is, and your code is very complicated. But what I do know is that it is not needed. Also, I believe you don't need to put anything in the "scissors" section, and instead just put "else" and computerChoice = "scissors";.

Please use my code as reference. I hope my code helps!


&& stands for the boolean operator and e.g. the statement A && B would only be true if both A and B are true at the same point or as an example of arcwhiz90664's code:

is true when computerChoice is smaller than 0.33 (you can omit the leading 0) and if computerChoice is bigger than 0. So basically we use this operator to chain conditions to a bigger one.

But you're right one does not need it at that point. And your also right with the other point:

The problem results from using a "condtion" after else. But else has no condition as it is the default case. I wrote a longer post over here covering conditions and you should be able to extract why this is a problem:

if not feel free to ask.