Keep on getting "There was a problem with your syntax please help me


#1

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


#2

take out these characters */


#3

Im gettting this problem to!! I just started out and I cannot understand whats wrong on this page?
Ive tried retyping the entire code multiple times. can someone have a look?


#4

On line 22, you are giving else a condition. In an if/else statement, the if code will execute when the if condition is met. Otherwise, else code executes. There is no requirement for else to have a condition.


#5

i figured that, there is an if condition set on line 18, plus that part wasnt bothering me earlier because i entered that code on the previous (level? stage?).

Its the else statement on line 31 thats creating the error, exceptn i have the if condition in on line 27 and if i erase the else statement on 31 and plug in the right answer for the if statement it works just fine


#6

There's a semicolon after your feedback condition. Why?


#7

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