The arguments of my function are choice1 and choice2, but it's telling me to call the function with computerChoice and userChoice


#1



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


It does everything right in console, but it says to call the "compare" function with "computerChoice" and "userChoice" as arguments, even though it says in this exercise that the arguments should be choice1 and choice2.

All other related topics on this problem say that it has something to do with global vs. local variables, but I don't know how or why: if I set the arguments of a function as (choice1,choice2) why am I being told to call the function by passing it (computerChoice,userChoice) arguments!?

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


#2

What you do here does not account for all your code.

Calling it with userChoice and computerChoice for all choices checked for and accounted for by your code so what they want you to do is just write,

compare(userChoice, computerChoice)


#3

Oh.

Oh wow...

I'm dumb.

Thanks!


#4

Haha no you're not it was just a simple mistake. :slight_smile: