A little help?


I've tried everything!

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

var computerChoice = Math.random()

computorChoice = function (userChoice){

if(computerChoice === 0 , 0.33) {


} else if(computerChoice === 0.34 , 0.66);{


} else {





the instrution says
If computerChoice is between 0 and 0.33, make computerChoice equal to "rock".

so it should be like that

   if(computerChoice < 0.33){
       computerChoice = "rock";

and the second says...

If computerChoice is between 0.34 and 0.66, make computerChoice equal to "paper".

that should be like that

else if(computerChoice <= 0.66);{
    computerChoice = "paper";

and the third one

If computerChoice is between 0.67 and 1, make computerChoice equal to "scissors".

iits will be the else stetement

else {
   computerChoice = "scissors";

I hope that I could Help ....


Some additions to what @wizmarco already said:

No semicolons after conditions:
else if(computerChoice <= 0.66);{

The , operator chains two statements and the latter gives the value so:

computerChoice === 0 , 0.33

computes computerChoice ===0 which is never used and the value of the whole statement is 0.33 . And as 0 has a value of false and every other number is treated as true you'll always pick this option.

What did you expects this to do?

Last but not least using a function is cool but better wait till the last exercise of this course where you can test your code without the restrictions to pass the exercise.