Syntax error when i use > or <


how come it says that < and > are unexpected tokens?


Depends on how you use it. Put a > or < in the middle of nowhere in your code, then yeah, it's a syntax error.


I'm on the computer choice part two but here is what i have.

var userChoice = prompt("Do you choose rock, paper or scissors?")
var computerChoice = Math.random()
console.log (computerChoice)
if (computerChoice <= 0.33)
else if (computerChoice > 0.33, < 0.66)
else (computerChoice > 0.66, < 1)


These two gives syntax errors.

Reason 1:

No requirement for an else statement.

Reason 2:

Commas are syntax errors, because they are something that JS doesn't know.:smiley:

Reason 3:

You can just put computerChoice < 0.66 instead of putting the 0.33 and 0.66 thing together, because you can't. Unless you use &&, but don't use it. :smiley:


thx for the help :grinning:


Just an additional to reason two. There actually is a comma operator in javaScript (not covered in the track) which chains two statements together and gets it's value from the second one so for example:

name = value, name2 = value2;

would execute both but treats them as one statement (similar to the {} counting as one statement) and would have a value of value2.