Created
June 17, 2020 13:29
-
-
Save aksnell/d4a48876be4b648c172a54445161a051 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const rps = (firstThrow, secondThrow) => { | |
if (firstThrow === secondThrow) { | |
return 'Draw!' | |
} | |
switch (firstThrow) { | |
case 'rock': | |
return (secondThrow === 'scissors') ? 'Player 1 won!' : 'Player 2 won!' | |
case 'paper': | |
return (secondThrow === 'rock') ? 'Player 1 won!' : 'Player 2 won!' | |
case 'scissors': | |
return (secondThrow === 'paper') ? 'Player 1 won!' : 'Player 2 won!' | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment