Skip to content

Instantly share code, notes, and snippets.

@jamesflorentino
Created August 18, 2013 04:11
Show Gist options
  • Save jamesflorentino/6259860 to your computer and use it in GitHub Desktop.
Save jamesflorentino/6259860 to your computer and use it in GitHub Desktop.
Bato bato pik
function compare(choice1, choice2) {
if (choice1 === choice2) {
return 'Result is a tie';
} else if (choice1 === 'rock') {
if (choice2 === 'scissors') {
return 'Rock wins';
} else if (choice2 === 'paper') {
return 'Paper wins';
}
} else if (choice1 === 'paper') {
if (choice2 === 'rock') {
return 'Paper wins';
} else if (choice2 === 'scissors') {
return 'Scissor wins';
}
} else if (choice1 === 'scissors') {
if (choice2 === 'rock') {
return 'Rock wins';
} else if (choice2 === 'paper') {
return 'Scissor wins';
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment