Syntax Error Expected ")"


#1

Syntax Error Expected ")", I can't find what is wrong... and can only stare at it so long
-thank you (you guys rock!)

https://www.codecademy.com/courses/javascript-beginner-en-Bthev-mskY8/0/4?curriculum_id=506324b3a7dffd00020bf661#

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";
}else{
    computerChoice = "Scissors";
}

#2

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

example

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

#3

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


#4

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


#5

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