It says syntax error


#1

var userChoice=prompt("Do you choose Rock, Scissor or Paper");
var computerChoice = Math.random();
console.log(computerChoice);

if (computerChoice =<0.33) {
console.log(Rock);
}

else if (computerChoice=>0.33 && =<0.66) {
console.log(paper);
}

else if (computerChoice =>0.66 && =<1) {
console.log(Scissor);
}

whats wrong with this?
it says syntax error


Help #4!
#2

You should be doing computerChoice = "rock";

computerChoice = "paper";

computerChoice = "scissor;"

Try this and pls say exact error you're getting. Syntax error could be wide.


Stuck in Buld rock paper scissors game
#3

@bayoishola20 is right, you want to set a computerChoice so you can use this later to compare with the userChoice.

Also, your && comparison is not completely right, take a look here why not. You don't really need the && operator, if the if condition is true, else if and else will never run. So in else if you can simple check if the number is .66 or less, no need to use the and operator


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.