0

I've tried everything and I'm stuck. Can someone look at my code and see what I'm missing? I'm making a 'rock, paper, scissors' game.

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

var computerChoice = Math.random();
if (computerChoice < 0.16) {
    computerChoice = "rock";
} else if(computerChoice <= 0.36) {
    computerChoice = "paper";
} 

else if(computerChoice <= 0.56){
    computerChoice = "scissors";
} 

else if(computerChoice <= 0.76){
    computerChoice = "lizard";
}
else {
    computerChoice = "spock";
}



var compare = function(userChoice, computerChoice) {
   if (userChoice === computerChoice) {
       return"It's a tie!"}

I have an html doc attached to the js file. I want to make userChoice appear after a button is pressed.

Jarvis
  • 1

0 Answers0