-
-
Save DaneSirois/244656e48bfc21ded550c34d13f68409 to your computer and use it in GitHub Desktop.
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
var numOfDice = process.argv.slice(2); | |
function rollDice(diceNumber) { | |
var diceRolls = []; | |
for (var i = 0; i < diceNumber; i++) { | |
var dice = Math.floor(Math.random() * (6 - 1 + 1) + 1) | |
diceRolls.push(dice); | |
} | |
return ("Rolled dice: " + diceRolls.join(", ")); | |
} | |
console.log(rollDice(numOfDice)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment