Help! Error: missing ) after condition


var userChoice = prompt ("Do you choose rock, paper, or scissors?");
var computerChoice = Math.random();
console.log (computerChoice);
if (computer choice <= 0.33)
computerChoice = "rock";
else if ( computerChoice >= 0.67 )
{ computerChoice = "scissors";
{ computerChoice = "paper";

the above is my code. I have been checking my conditions and parentheses and I can't seem to find the syntax error.


I don't see any mistake...

Try to cut/paste your console.log() after your else{...} since you want 'rock' or 'paper' or 'scissors' to be displayed, not number.



if (computer choice <= 0.33)

computer and choice are treated as 2 variables so the interpreter expects some kind of connection or at least a ) which tells it that the condition of the if is finished. Just use computerChoice instead and you should be fine.


i used computerChoice all through but the error keeps occurring.


else if(computerChoice <= 0.67) I think this one works, try using less than instead of greater than.

also i think if it is >=0.67 computerChoice will never end up in selecting paper


He/She switched the cases >=0.67 would normally be covered by the else and assigns "scissors" which it does here too. So the part <=0.67 that normally assigns "paper" is now covered by the else and does as well what it is supposed to do. So the order might be confusing as it's not what it is covered in the instructions or freely seen but it still works as it follows the same logic.