If, else if, else. Where is the mistake?



The problem is in our elif statement. Please post your code so I can help you understand what the problem is.


The code that I wrote is literally this one:

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

var computerChoice = Math.random();


if (computerChoice < 0.33) {


else if (computerChoice <= 0.66 ) {


else (computerChoice > 0.67) {





These statements are incorrect because you are not trying to print out values but assign them so what you would do is,

computerChoice = "rock"

and so on...

And also,

Print out computerChoice after all the if and else statements.


Brilliant! Thank you so much for everything!

I owe you one.


You're super welcome :grin:

If that was the answer you were looking for feel free to click the solution button below my reply. :slight_smile:


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