What's wrong with my syntax?



Oops, try again. There was a problem with your syntax.

var userChoice = prompt("Do you choose rock, paper or scissors?");
var computerChoice = Math.random();
if (computerChoice < 0.34) {
	computerChoice = "rock";
} else if(computerChoice <= 0.67) {
	computerChoice = "paper";
} else {
	computerChoice = "scissors";
} console.log("Computer: " + computerChoice);
var compare = function(userChoice, computerChoice) 

if(userChoice === computerChoice) {return "The result is a tie"}

if (userChoice === "rock") if (computerChoice === "scissors") {return "rock wins";}
else {return "paper wins";}

if (userChoice === "paper") if (computerChoice === "rock") {return "paper wins";}
else {return "scissors wins";}

if (userChoice === "scissors") if (computerChoice === "paper";) {return "scissors win";}
else {return "rock wins";}

compare(userChoice, computerChoice)


You got this far.;;; What is the point of posting this question?


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