Skip to content

Instantly share code, notes, and snippets.

@marshallmurphy
Created July 16, 2020 19:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marshallmurphy/19360634a0fd0aa4958a244625d6ec73 to your computer and use it in GitHub Desktop.
Save marshallmurphy/19360634a0fd0aa4958a244625d6ec73 to your computer and use it in GitHub Desktop.
function diceGame(playerRolls, dealerRoll) {
let match = false
playerRolls.forEach((roll, index) => {
for (let i = index + 1; i < playerRolls.length; i++) {
if (roll + playerRolls[i] === dealerRoll) {
match = true
}
}
});
return match;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment