What if choice 1 = scissors


#1

My error is that i have to "Make sure to call your compare function with userChoice and computerChoice as the arguments!," but I don't know how to. Please help... :point_down:

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


#2

Pristine code and still this question?

var var1, var2
var my_func = function (args) {

}

console.log(my_func(var1, var2));

The above is a function call in a method call.


#3

what are you talking about?


#4

The question comes as a surprise given the pristine nature of the code. Whomever composed that code most certainly know how to...

Review the example above and glean the information clues from the error message.


#5

I can't understand a single thing that you are saying...


#6

I apologize if you are not getting me. Do you still have a problem or have you got past this?


#7

No, it's fine, I got past this one. Sorry if I was being rude


#8

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.