Created
April 20, 2020 07:22
-
-
Save ilonacodes/fafe9fa4368e9c82efa2f917af93f3c5 to your computer and use it in GitHub Desktop.
index.js | VanillaJS Implementation
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
// index.js | VanillaJS Implementation | |
const dices = window.document.querySelectorAll('.dice'); | |
const roll = () => { | |
dices.forEach(dice => { | |
const dots = Math.floor(Math.random() * 6) + 1; | |
dice.setAttribute("data-dots", dots); | |
}) | |
}; | |
// first initial roll for when the page loads | |
roll(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment