The wrong result is returned (i.e. paper instead of scissors) in the 1 part


actually no errors are found in code, BUT the problem is that the result that is returned is not right. As seen on the screenshot below it returns "paper" instead of "scissors" when computerChoice is bigger then 0,76

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


That's because your else if statement should have multiple conditions.


I believe this is the case because instead of 0.67 you have 0,67.


As far as I understood the conditon is written fully, because:
var computerChoice = Math.random(); // this means that the variable computerChoice is (0;1)
so as a result the condition for else if should be just >=0,67, knowing that it is less then 1 a priori.

Either way when making a multiple condition it doesn't work right as well


You. Are, Amazing, I ADORE ppl who are so attentive to details!))))) Oh my gosh, now it's me sitting here, blushing and feeling stupid.... :grinning: THANK YOU A LOT! :slight_smile: You're genius!


No problem lol I make mistakes like that all the time haha I think half my questions on the forum have been spelling errors xD Hope the rest of your coding goes well! :smiley:


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