Help


#1

On part 6 of let's build rock paper scissors and it won't work no matter what I try. And yes I know my brackets are bad

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

else if (choice1 === "rock":wink:{
if (choice2 === "scissors":wink:{return "Rock wins!"

} else {return "Paper wins!"

}
}
}


#2

The winks should not be there. The semi-colon goes after the closing parenthesis, so it would be


#3

Thanks bro
(Here's my 20 chars)


#4

Completely incorrect. There is no semi-colon anywhere in an if structure (except on the statements contained in each block).

if ( ... ) {

}
else if ( ... ) {

} else {

}

#5

Sorry, that was an airhead moment on my part.
In my sleep deprived, coffee fueled wake, I had realised that the semi-colons were wrong, but so was I.


#6

O lol, don't worry, I think it was the brackets I screwed up anyways


#7

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