Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created February 5, 2019 23:44
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 codecademydev/26a03ef91d1fce2035a02e04e8ea0f26 to your computer and use it in GitHub Desktop.
Save codecademydev/26a03ef91d1fce2035a02e04e8ea0f26 to your computer and use it in GitHub Desktop.
Codecademy export
const rollTheDice = () => {
// Math.random() gives us a random number from 0 up to, but not including, 1
// We multiplied that by 6 to get a number between 0 and up to, but not including, 6
// But since we actually wanted numbers from 1 to 6, inclusive, we added 1
let die1 = Math.floor(Math.random() * 6) + 1
let die2 = Math.floor(Math.random() * 6) + 1
return die1 + die2
}
console.log(die1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment