Not sure what I am doing wrong


#1



So I keep receiving an "illegal return statement" message. Also, I can't get my prompt message to work. Your input would be greatly appreciated!


var userChoice = prompt("Do you want to play rock, paper, scissors?");
var computerChoice = Math.random();

//computer's orders

if (computerChoice == (0 < 0.33)) 
    return "rock";
    if (computerChoice == (0.34 < 0.66))
        return "paper";
            if (computerChoice == (0.67 < 1))
                return "scissors"; 
                
                
function result(userChoice,computerChoice){
    if (userChoice == computerChoice)
        return "We both win! It is a tie!";
        
        //userChoice rock
        
        if (userChoice =="rock" && computerChoice == "scissors")
            return "You win!";
                else return "You lose!";
                
                //userChoice paper
                
                     if (userChoice =="paper" && computerChoice == "rock")
                        return "You win!";
                            else return "You lose!";
                            
                //userChoice scissors
                               if (userChoice =="scissors" && computerChoice == "paper")
                                     return "You win!";
                                            else return "You lose!";
                
}


#2

Remember the syntax for if statements

if(something > somethingelss) {
//run something 
} 
else{
//then run this
}

JavaScript Glossary
JavaScript Glossary - MDN


#3

Thank you for your help :slightly_smiling: