Help me PLEASE!


#1

There is my code!Why is there "Unexpected token )"?
Give an advice)

var userChoice = prompt("Do you choose rock, paper or scissors?");
var computerChoice = Math.random();
if () {

} else if () {

} else {

}


#2

I can't make a picture of it,so it's like a text ok?


#3

This error is caused by the empty conditions of the if and else if. The scheme of code is totally correct.

var userChoice = prompt("Do you choose rock, paper or scissors?");
var computerChoice = Math.random();
if (true) {

} else if (true) {

} else {

}

#4

OMG,Thanks!But I have a question again?
Find a mistake please

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


#5

var compare = function(choice1, choice2) {
if(choice1 === choice2) {
return "The result is a tie";
}
};

This is a code which they say should be.What is wrong in the code ahead?


#6

Which lesson(link please)? Show us your code!

And please use in the texteditor from these Forum the </> sign for your code.
It is hard to read without.


#7

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