Rock, Paper, Scissors- Unexpected <=?


#1

This is what I typed and the error reads; "SyntaxError: Unexpected token <="
I can't figure out what is wrong with my code. Can someone help?

var userChoice = prompt("Do you choose rock, paper or scissors?")
var computerChoice = Math.random();

console.log(computerChoice);

if(computerChoice >=0 && <=.33) {
return("rock")
}
if else(computerChoice >=.34 && <=.66) {
return("paper")
}
else {
return("scissors")
}


#2

here take a look at this

var userChoice = prompt("Do you choose rock, paper or scissors?");
var computerChoice = Math.random();

console.log(computerChoice);

//in the if condition you had an error
//each time you use a comparison operand
// you must explicitly define the two items you are
// comparing

//also
// you can only call return inside a function and not outside of it
if(computerChoice >= 0 && computerChoice <= 0.33) {
    computerChoice= "rock";
}
else if(computerChoice >=0.34 && computerChoice <=0.66) {
    computerChoice= "paper";
}
else {
    computerChoice = "scissors";
}

#3

Thanks @rydan that worked!


#4

I ran the following code, & it's not letting me proceed stating: "Did you set var computerChoice = Math.random() ? The capital 'M' in 'Math' is important!", but I do have the 'M' capitalized... Any insight? Here's the code I ran:

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

console.log(computerChoice);

if(computerChoice >= 0 && computerChoice <= 0.33)
{
computerChoice = ("rock");
}
else if(computerChoice >=0.34 && computerChoice <=0.66)
{
computerChoice = ("paper");
}
else
{
computerChoice = ("scissors");
}


#5

@wgezella I couldn't find anything that is different, except you don't have an 's' after your first 'scissors' (but I don't see how that would change anything).
Try refreshing the page, but I don't know what else. Sorry I couldn't be of more use.