London | 26 ITP January | Mouawia Elkhalifa | Sprint 3 | Alarm Clock#1087
London | 26 ITP January | Mouawia Elkhalifa | Sprint 3 | Alarm Clock#1087MouawiaElkhalifa wants to merge 2 commits intoCodeYourFuture:mainfrom
Conversation
a6bbeae to
debc327
Compare
cjyuan
left a comment
There was a problem hiding this comment.
-
Code works fine if a user only clicks the "Set Alarm" button once.
However, if the user enters a time and then clicks the "Set Alarm" button multiple times, the countdown clock will not display properly.
Can you fix the issue? -
You missed updating
index.htmlaccording to an instruction inreadme.md.
cjyuan
left a comment
There was a problem hiding this comment.
(1) Currently when starting a new countdown, the application does not always return to a clean initial state, which can lead to inconsistent behavior between runs. (Hint: a user may not click the "Stop" button first before starting a new count down.)
You can consider introducing a dedicated reset function to return the app to a clean initial state to help ensure consistency.
(2) Can you make the "Stop" button to also stop the count down? You can add another "click" event listener to the button to avoid modifying the original code.
| const timeDisplay = document.getElementById("timeRemaining"); | ||
|
|
||
| if (isNaN(secondsLeft) || secondsLeft <= 0) { | ||
| timeDisplay.innerText = "Time Remaining: 00:00"; |
There was a problem hiding this comment.
Could consider calling updateDisplay(0) on line 8, trading few milliseconds for simpler code, and keep the logic of displaying time in one place.
Learners, PR Template
Self checklist
Changelist
In this PR, I have completed the Alarm Clock assignment for Sprint 3.