Please, somebody help me. Whats wrong with my code


#1

Tell me please. whats wrong with it ? or its a bug ?

var userChoice = prompt(" Do you choose rock, paper or scissors?");
var computerChoice = Math.random();
console.log(computerChoice);
if (computerChoice >= 0 $$ computerChoice <= 0.33) {
return computerChoice = "rock" ;
}
else if (computerChoice >= 0.34 $$ computerChoice <= 0.66) {
return computerChoice = "paper";
}
else
{
(computerChoice >= 0.67 $$ computerChoice <= 1) {
return computerChoice = "scissors";
}

It says that I have some syntax error and
SyntaxError: Unexpected identifier


#2

the and operator is: && not $$

but if you do it right, you don't need the and operator


#3

Ok, i fixed it. but now it says that I have a SyntaxError: Illegal return statement


#4

return is for inside a function, you don't have a function.

You are updating a variable, no need to use return for that


#5

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