Part 8: What if choice1 = scissors


#1

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) {

// this takes care of the 3 times when there is a tie
if (choice1 === choice2) {
    return "The result is a tie!";
}

// this takes care of the 2 other "rock" possibilities
if (choice1 === "rock") {
    // in here there should be your choice2 === "scissors" code
}

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

}

Can someone please tell me what is wrong with my code above?


#2

if (choice1 === "rock") {
// in here there should be your choice2 === "scissors" code
}

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

put this if-else statement inside the other if statement. like so.

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