Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fixed issue #37: Reset button is added#43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
Prachit707 wants to merge1 commit intosahandghavidel:main
base:main
Choose a base branch
Loading
fromPrachit707:reset_added
Open
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletionsprojects/dice-roll-simulator/index.html
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,10 +11,8 @@
<h1>Dice Roll Simulator</h1>
<div class="dice" id="dice">&#9860;</div>
<button id="roll-button">Roll Dice</button>
<ul id="roll-history">
<!-- <li>Roll 1: <span>&#9856;</span></li>
<li>Roll 2: <span>&#9860;</span></li> -->
</ul>
<button id="reset-button">Reset</button>
<ul id="roll-history"></ul>
<script src="index.js"></script>
</body>
</html>
9 changes: 7 additions & 2 deletionsprojects/dice-roll-simulator/index.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -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 = [];
Expand DownExpand Up@@ -51,3 +50,9 @@ buttonEl.addEventListener("click", () => {
rollDice();
}, 1000);
});

resetButtonEl.addEventListener("click", () => {
historyList = [];
rollHistoryEl.innerHTML = "";
diceEl.innerHTML = "&#9860;"; // Reset the dice face to the default
});

[8]ページ先頭

©2009-2025 Movatter.jp