5/9 Both choices are the same! Unexpected token =


#1

Hi,

I can't seem to figure out whats wrong with my syntax.
Could someone help me please?


#2

You put four equal signs, not three


#3

omg seriously xD

That's a sign that I should take a break.

Thank you!


#4

No prob! Glad I could help!


#5

//*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";
}
};

NEED HELP NOT WORKING THANKS


#6

the last if statement you should put the "!" at the end of the string like that return "The result is a tie!";


#7

thanks now it is working


#8

//*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!";
}if(choice1 === choice2) {
return "The result is a tie";
}

else if(choice1 === "rock") {

if(choice2 === "scissors") {
    return "rock wins";
}
else {
    return "paper wins";
}

}
};

Here is my code neeed help


#10

please help me out guys... I am stuck here for quite a while, getting so frustrated.


#11

Hi try to remove a { after you if (choice1 === choice2) because all your if and alse statement
should be inside the compare function.


#12

Can you help? It keeps saying "Oops, try again. Did you create a function called compare?" here's my code.

/*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!"
}


#13

I think the problem is that you used a capital C when you wrote:
if(choice1 ===Choice2)

Try changing it to a non capital c.


#14

oh and your missing some { }
{ at the end of: if(choice1 ===Choice2)

and

} at the end of your code.

Don't forget to use a ; at the end of a function.


#15

thx its working now y