-
-
Save potatowave/2752b908e9cfb09a779bc4a444b1ec6b 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