Skip to content

Instantly share code, notes, and snippets.

@barfi
Last active March 7, 2023 00:31
Show Gist options
  • Select an option

  • Save barfi/fa165dfcfd3ea1ac92a00709551c0af7 to your computer and use it in GitHub Desktop.

Select an option

Save barfi/fa165dfcfd3ea1ac92a00709551c0af7 to your computer and use it in GitHub Desktop.
Rock paper scissors
/**
* 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