What's wrong with my syntax?


#1


https://www.codecademy.com/en/courses/javascript-beginner-en-Bthev-mskY8/1/1?curriculum_id=506324b3a7dffd00020bf661


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"}

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

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

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

compare(userChoice, computerChoice)


#2

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


#3

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