Stuck in Buld rock paper scissors game


Whats wrong with this code?

var userChoice = prompt("Do you choose rock, paper or scissors?");
    var computerChoice = Math.random() {
    if (computerChoice =<0.33) {
    } else if (computerChoice>=0.34 && <=0.66) {
    } else {

I am getting this error :confused: ;

Oops, try again. There was a problem with your syntax.


the syntax error you are currently experiencing is here:

var computerChoice = Math.random() {

math random is a function call, not a function declaration:

var computerChoice = Math.random();
// log the computerChoice to the console

don't use {}, no need. That should solve your current problem. There are more problems, please try to figure them out first yourself. Maybe take a look at thios topic, that should help you


Also you want to make your comparison with a <= in this particular case so that it looks like this

if (computerChoice <= 0.33)

And here just one small edit, take the and operator out and you should be good!

else if (computerChoice >= .34 <= .66


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