[Solved] SyntaxError: Unexpected token <


#1

I am having syntax error.

can someone help me & tell me what i did wrong

var userChoice = prompt("What Do you choose rock, paper or scissor?");

var computerChoice = Math.random();
if(computerChoice =< 0.33)

{
return("rock");
}

else if (computerChoice > 0.33 & =< 0.66)

{
return("Paper");
}

else
{
return("scissors");

}

console.log(computerChoice);

here's my code


#2

Hey @nar3nd3r! Your problem here is that you swaped the equal sign here:

Its suppose to be <= not =< .

That should do it! Hope this helped!


#3

Thanks for replying mate!

I chnaged the sign but still have another error

SyntaxError: Unexpected string

something wrong with code i guess.

var userChoice = prompt("Do you choose rock, paper or scissor?");

var computerChoice = Math.random();
if(computerChoice < 0.34)

{
computerCheck"rock";
}

else if (computerChoice <= 0.67)

{
computerCheck"Paper";
}

else
{
computerCheck"scissors";

}

console.log("Computer:" +computerChoice);

^^ This is the new code i am doin.


#4

Hey its suppose to be computerCheck = "Paper" here.


#5

Oh! My bad.

Thanks a ton mate! :')
Solved :smile: