A little help?


#1

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) {

comand("rock");

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

comand("paper");

} else {

comand("scissors");

}

}


#2

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 ....


#3

Some additions to what @wizmarco already said:

No semicolons after conditions:
else if(computerChoice <= 0.66);{
http://discuss.codecademy.com/t/conditions-blocks-and-semicolons/2176?u=haxor789

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?
comand("rock");

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.