Syntax Error Expected ")"


Syntax Error Expected “)”, I can’t find what is wrong… and can only stare at it so long
-thank you (you guys rock!)

Syntax Error Expected “)”

var userChoice = prompt("Do you choose rock, paper or scissors?");
var computerChoice = Math.random();
if (computerChoice <= 0.33){
    computerChoice = "Rock";
}else if (computerChoice >= 0.33 and <= 0.67){
    computerChoice = "Paper";
    computerChoice = "Scissors";


Hi the comparator and in Javscrip is llike that && instead of and then you should put something to compare before the <= 0.67.


20 === 5 * 4 && 15 <= 3 * 5


YES! that was it! Thank you! The error does not reveal the real issue… I wish it was a little easier!


It actually does you just need to know how to read it. In this case the first part computerChoice >= 0.33 is already a satisfying condition so when the and turns up it is treated as a new variable therefore the interpreter “thinks” that you just forgot to close the condition with the “)”.


Something learned through practice and experience then… :smile: thanks!