Last active
March 7, 2023 00:31
-
-
Save barfi/fa165dfcfd3ea1ac92a00709551c0af7 to your computer and use it in GitHub Desktop.
Rock paper scissors
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
| /** | |
| * Case with 3 objects | |
| */ | |
| const abc = (x, y, map = {a:0,c:1,b:2}) => { | |
| return ['P1 == P2', 'P1', 'P2'][(map[x] - map[y] + 3) % 3] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment