Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save NicholasMurray/5188879 to your computer and use it in GitHub Desktop.
Save NicholasMurray/5188879 to your computer and use it in GitHub Desktop.
function theWinnerIs(humanChoice, computerChoice) {
if (humanChoice === computerChoice ) {
return 'no winner it is a draw';
}
if ((humanChoice === 'rock') && (computerChoice === 'scissors')) {
return 'human';
}
if ((humanChoice === 'rock') && (computerChoice === 'paper')) {
return 'computer';
}
if ((humanChoice === 'paper') && (computerChoice === 'scissors')) {
return 'computer';
}
if ((humanChoice === 'paper') && (computerChoice === 'rock')) {
return 'human';
}
if ((humanChoice === 'scissors') && (computerChoice === 'rock')) {
return 'computer';
}
if ((humanChoice === 'scissors') && (computerChoice === 'paper')) {
return 'human';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment