Trouble with Rock Paper Scissors code


#1



exercise 5- both choices are the same
Exercise

says syntax error expected ')'


Replace this line with your code. 
var userChoice= prompt('Do you choose rock, paper or scissors");
var computerChoice=Math.random():
if(computerChoice<0.34) {
computer Choice= "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!"
}
elseif(choice1==="rock"){
if(choice2==="scissors"){
        return "rock wins";
}
else{
        return "paper wins";
}
}
elseif(choice1==="paper"){
if(choice2==="rock"){
       return "paper wins";
}
else{
       return "scissors wins";
}
}
elseif (choice1==="scissors"){
if (choice 2==="rock"){
        return" rock wins";
}
else{
        return "scissors wins";
}
}
}
compare(userChoice,computerChoice);


#2

You have a single quotation mark instead of a double one, ("Do you..


#3

thanks I tried double quotes- same error


#4

Should be;
}console.log("Computer:"+" " +computerChoice);


#5

^^^this

@7tom7 seems like you have a lot of typo issues; in addition to those @digitalpro14484 pointed out I saw:

var computerChoice=Math.random():

computer Choice= "rock";

if (choice 2==="rock"){

I would suggest you review your code closely for these kinds of slips first and see if that resolves the error.


#6

thanks doing review now


#7

Good luck, let us know if you still have trouble after that :slight_smile: