Created
March 17, 2018 01:35
-
-
Save awwong1/35d8c4eb93fe2c90662cf4d8effac33d to your computer and use it in GitHub Desktop.
javascript roll dice
This file contains 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 rollDice = () => Math.floor(Math.random()*1414 % 6 + 1) | |
// > rollDice() | |
// 5 | |
const rollNDice = (n) => Array(n).fill().map(rollDice) | |
// > rollNDice(6) | |
// [ 5, 3, 3, 5, 5, 2 ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment