diff --git a/projects/dice-roll-simulator/index.html b/projects/dice-roll-simulator/index.html index edf81b5..7a01d96 100644 --- a/projects/dice-roll-simulator/index.html +++ b/projects/dice-roll-simulator/index.html @@ -11,10 +11,8 @@

Dice Roll Simulator

- + + diff --git a/projects/dice-roll-simulator/index.js b/projects/dice-roll-simulator/index.js index 8deecde..69718a6 100644 --- a/projects/dice-roll-simulator/index.js +++ b/projects/dice-roll-simulator/index.js @@ -1,7 +1,6 @@ const buttonEl = document.getElementById("roll-button"); - +const resetButtonEl = document.getElementById("reset-button"); const diceEl = document.getElementById("dice"); - const rollHistoryEl = document.getElementById("roll-history"); let historyList = []; @@ -51,3 +50,9 @@ buttonEl.addEventListener("click", () => { rollDice(); }, 1000); }); + +resetButtonEl.addEventListener("click", () => { + historyList = []; + rollHistoryEl.innerHTML = ""; + diceEl.innerHTML = "⚄"; // Reset the dice face to the default +});