What if the choice is scissors? Error


#1

I don't understand the error. I thought I was already calling the two functions?


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


Oops, try again. Make sure to call your compare function with userChoice and computerChoice as the arguments!


} 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") { // 1st else if condition braces start
        if(choice2 === "scissors") {
            return "rock wins";
        } else {
            return "paper wins";
        }
        } // 1st else if condition braces close
    else if (choice1 === "paper") { // 2nd else if condition braces start
        if (choice2 === "rock") {
            return "paper wins";
        } else {
            return "scissors wins";
        }
      } // 2nd else if condition braces close
    else if (choice1 === "scissors") { // 3rd else if condition braces start
        if (choice2 === "rock") {
            return "rock wins";
        } else { 
            return "scissors wins"; 
        }
    }  // 3rd else if condition braces close  
    else if (choice1 === "paper"){ //4th else if condition braces start
        if (choice2 === "rock"){
            return "paper wins";
        }
        else{
            return "scissors wins";
        }
    } //4th else if condition braces closes
};


#2

It looks like you repeat the code block for choice1=== "paper". Why? The instructions want you to call the compare function and swap in userChoice and computerChoice in place of choice1 and choice2.


#3

I apologize but that was the correct code in the last exercise I did. So I literally just swap choice1 and choice2 with userChouse and computerChoice?


#4

yes  

choice1 and choice2 don't exist


#5

I'm kind of confused. Here is what the instructions say.

Instructions
Under your old code, use the same structure as the past two exercises and finish off your function.
We need to use the variables userChoice and computerChoice. Uncomment the first lines of the code by deleting /* on line 1 and */ on line 9, the variables are now active and can be called.
Call your function and pass in userChoice and computerChoice as your two arguments.
Press Save & Submit Code and your game should work! Congratulations!


#6

which part you confused about ?


#7

So do I just literally do two more else if's or is it just 1 else if with an if under it?
Is it:

else if(condition)
if(condition)
statement


#8

Nevermind. My brain had a dumb moment. I figured it out. Thanks!


#9