Syntax Problem with Rock, Paper, Scissors?


#1



Build Rock, Paper Scissors

It is saying incorrect syntax when I do the below. However much I look at it I can't see a syntax error ?

var userChoice = prompt ("Do you choose rock, paper or scissors?");
var computerChoice = Math.random ();

if (computerChoice >= 0 && <= 0.33) {
    
    console.log ("rock");
    
} else if (computerChoice >= 0.34 && <= 0.66) {
    
     console.log("paper");
   
} else {
    
      console.log("scissors");
    
}


#2

Hi these lines

(computerChoice >= 0 && <= 0.33) 
(computerChoice >= 0.34 && <= 0.66)

after the && it's missing something to compare. with 0.33 and 0.66


#3

What would that be? I don't understand?


#4

the first one

(computerChoice >= 0 && <= 0.33)

you compare

computerChoice >= 0

then you alsowant to compare

??  <= 0.33

something with the 0.33 right?
Read again the instruction

If computerChoice is between 0 and 0.33, make computerChoice equal to "rock".
If computerChoice is between 0.34 and 0.66, make computerChoice equal to "paper".
If computerChoice is between 0.67 and 1, make computerChoice equal to "scissors".

the first one should be.. look inside the if statement

if (computerChoice >= 0 && computerChoice <= 0.33) {
    computerChoice = "rock";
}

do you see now how the other will be?


#5

Ah yes, I get it now. Thanks Wizmarco !!