javascript - compare function syntax error -


i trying make rock paper scissors game code academy , told create function compare(). have written following code:

function compare(choice1,choice2){ if (choice1 == choice2){     console.log("the result tie!"); } else{     console.log("the computer wins"); } 

when run it, "the result tie!" appears twice error code saying "oops, try again! compare function not return 'the result tie!' when there tie." know there wrong syntax new don't know where. help?

you're not returning function, you're logging result. after either of console.log statements, send return

console.log("the result tie!"); return true; //or whatever 

Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -