java help (codecademy tut)...
so im learning java on codecademy and im on Compare Function part 2. what if choice 1 is rock... (i already ask for help but no one reply for shit...)
info given:
hint given:
my code:
error: Did you define a function called compare?
what i do wrong? >:I
been stuck on this shit for 3 days -.-
info given:
Code:
You're doing great! Now we consider the other scenarios. Let's break the problem down a little. What if choice1 is "rock"? Given choice1 is "rock", a. if choice2 is "scissors", then "rock" wins. b. if choice2 is "paper", then "paper" wins. How do we structure this? It's a bit different to what we have already seen. We will first have an if statement. And then the code inside that if statement will be...another if statement! Under the existing code in the function compare, write an if statement where the condition is choice1 equals "rock". In the code block for the if statement, write an if / else statement. In that statement, if choice2 is "scissors", return "rock wins". Otherwise, return "paper wins".
Code:
This putting if statements inside if statements is a little tricky at first. Below is an outline of what the syntax should look like:
if (condition) {
if (condition) {
return "some string";
} else {
return "some other string";
}
my code:
Code:
var compare = function(choice1, choice2)
{
if (choice1 === choice2);
{
return "The result is a tie!";
} if (choice1 === "rock"):
{
if (choice2 === "scissors") {
return "rock wins";
} else {
return "paper wins";
}
} function(compare)
};
error: Did you define a function called compare?
what i do wrong? >:I

been stuck on this shit for 3 days -.-
idk which part am i suppose to look at
