View Code? Open in Web Editor
NEW
This project forked from juneate/dice-game
A simple dice game example.
CSS 10.36%
HTML 24.41%
JavaScript 65.23%
dice-game's Introduction
- Fork this repository by clicking the "Fork" button in the top-right corner
- Clone the new repository to your local machine using
git clone {url}
- Complete the steps in the HTML document to build a prototype interface for a dice game
- See index.html for an example interface written within a comment block
- Call
getRandomDiceRoll()
and store the result as a variable named diceRoll
- Update user interface (
document
), showing the dice face (svg image) that matches the roll number
- Use
diceRoll
to update the label "You rolled: #" (replacing # with the roll)
- Wrap the dice roll procedure in a function named
rollTheDice()
, call it from the console
to test
- Before starting, consider using the browser's developer tools to prototype a solution manually
- Start by changing the document from the "Elements" tab to go from a roll 3 to roll 4
- Next, consider prototyping within JS by assigning a number to
diceRoll
before getting a random
- This will assist by creating a controlled case before assigning a random value
- Use the console to test each line of code that affects the document, as you code
- Mis-selecting elements will create errors that prevent the page from working as intended
dice-game's People
Contributors