2.8 Build rock paper scissors - What am I doing wrong?!?!


The exact exercise I’m stuck on is 8.What if choice 1 was scissors and the link to it is here:

Every time I click submit I get a syntax error and I can’t see what the problem is. I was wondering whether anyone here could give some quick tips on how to get this code working? I’ve tried several things, but nothing seems to quite do the trick. There may be more than one error because I’ve tried to edit my previous code as well thinking that it was perhaps an error with the answer whatever checking mechanism CodeAcademy uses :slight_smile:


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!”;

else if (choice2 === "scissors") {
    if (choice1 === "paper") {
    return "scissors wins";
else {
    return "paper wins";


else if(choice1===“paper”) {
if (choice2===“rock”) {
return “paper wins”;}
else {
return “scissors wins”;}
else if (choice1 === “scissors”) {
if (choice2 === “rock”) {
return “rock wins”;}
else {
return “scissors win”;}


<do not remove the three backticks above>


You have an extra closing bracket } before the last else if statment.


Cheers! I saw that response to a similar question about this exercise so many times and I could have sworn that I had the right amount of brackets. Great help, thanks! :slight_smile:


var userChoice = prompt (“Do you choose rock, paper or scissors?”);
var computerChoice = Math.random();

if (computerChoice <= 0.33) {
} else if (computerChoice >= 0.34 <=0.66 ){
} else {