7/9 is very confusing


Inside the compare() function under the existing code, write another else if statement where the condition is choice1 === "paper".

I don't know how to play this game and, thus, the instructions are not sufficient. So, is it really under? Is it not interleaved?

I'm sorry, these culture-specific games are difficult to grasp outside some boundaries, just like imperial measures, American football and baseball. But I digress.


see this

/*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(choice1 === "rock") {
            if(choice2 === "scissors") {
                return "rock wins";
                } else {
                    return "paper wins";
            } else if (choice1 === "paper") {
                if(choice2 === "rock") {
                    return "paper wins";
                    } else {
                        return "scissors wins";


Better get rid of the semicolons after your elses.


thanks! a lot for your advice :smile:


Maybe have a look at this post's post:
or google RPS its a really simple game and the underlying logic of many real time strategy games :smile:


That's exactly the info I was looking for! Thank you very much! With that table, I should be able to program it properly!