Please help! build R,P,S (Both Choices are the same)



We carried over the code from the previous section, but it is a comment. Leave it there for now.
Below the comment, declare a function called compare.
It takes two parameters, choice1 and choice2.
Inside the function, write an if statement. If choice1 === choice2, then return "The result is a tie!"


/*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(choice1, choice2)
if(choice1 === choice2) {
return "The result is a tie!";

Error Message:

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


You have no opening bracket after this statement, {


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