What if choice1 is rock?


#1

var compare=function(choice1,choice2)
if(choice1===choice2){
return "The result is a tie!"}
else if(choice1==="rock"){
if(choice2==="Scissors"){
return "rock wins";}
else{
return "paper wins"; }
}

ERROR SHOW LIKE THIS:
Oops, try again. There was a problem with your syntax.


#2

functions normally have curly brackets ({}) to indicate the start and end of a function:

var example = function(){
  // do something in the function
}

the curly brackets are missing in your case


#3

i also recommend to spell scissors correctly


#4

Thank you very much for helping :innocent:


#5

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