London | May-26 | Liridona Shehu | Sprint 3 | Module-Data-Groups - Alarmclock - #1309
Open
shehu-dona wants to merge 2 commits into
Open
London | May-26 | Liridona Shehu | Sprint 3 | Module-Data-Groups - Alarmclock#1309shehu-dona wants to merge 2 commits into
shehu-dona wants to merge 2 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
Luro91
reviewed
Jul 30, 2026
Comment on lines
+20
to
+26
| let currentMinutes = Math.floor(remainingSeconds / 60) | ||
| .toString() | ||
| .padStart(2, "0"); | ||
| let currentSeconds = Math.floor(remainingSeconds % 60) | ||
| .toString() | ||
| .padStart(2, "0"); | ||
| timeRemainingHeading.innerText = `Time Remaining: ${currentMinutes}:${currentSeconds}`; |
There was a problem hiding this comment.
This code is duplicated from line 9 to 16. How can you remove the duplication? (Duplicated code makes maintenance harder as you would have make changes in multiple places. Imagine the formatting should change for example)
Author
There was a problem hiding this comment.
Created a function formatTime() and call it when i need it.
| clearInterval(intervalId); | ||
|
|
||
| const initialSeconds = Number(document.getElementById("alarmSet").value); | ||
| remainingSeconds = initialSeconds; |
There was a problem hiding this comment.
What happens if I start the alarm with 0 seconds or a negative value?
Author
There was a problem hiding this comment.
Checked for 0, negative or empty input.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Self checklist
Changelist
A PR with a alarm app