Sheffield | 26-ITP-Jan | Seti Mussa | Sprint 3 | Alarm Clock#1178
Sheffield | 26-ITP-Jan | Seti Mussa | Sprint 3 | Alarm Clock#1178Seti-Jemal wants to merge 1 commit intoCodeYourFuture:mainfrom
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
cjyuan
left a comment
There was a problem hiding this comment.
-
Given a countdown is still active, when the users click the "Set Alarm" button with input equals to 0, then what do you expect the app to behave?
-
While a countdown is active, does the timer display look normal to you?
Note: We should respect instructions like DO NOT EDIT BELOW HERE; it is usually there for a reason. If you are curious about why, you can ask AI Why should programmers respect "DO NOT EDIT BELOW HERE" instruction in a file? (You have made some major changes to the original code, so don't worry about that this time).
| function updateDisplay() { | ||
| const heading = document.getElementById("timeRemaining"); | ||
| heading.textContent = "Time Remaining: " + formatTime(timeRemaining); | ||
| } |
There was a problem hiding this comment.
Why not include a parameter to
- make this function reusable (e.g. call
updateDisplay(0)to reset timer display) - avoid using a global variable
timeRemaining
?
|
|
||
| // TRIGGER ALARM | ||
| function triggerAlarm() { | ||
| document.body.style.backgroundColor = "red"; |
There was a problem hiding this comment.
To better separate presentation logic from application logic, you can consider defining a CSS class, and use classList.toggle() to apply/remove the style. For example,
document.body.classList.toggle("alarm-activated", true); // apply style
document.body.classList.toggle("alarm-activated", false); // remove style
|
|
||
| // START TIMER | ||
| function startTimer() { | ||
| clearInterval(timerId); |
There was a problem hiding this comment.
Currently when starting a new countdown, the application does not always return to a clean initial state,
which can lead to inconsistent behaviour between runs.
Hint: a user may not click the "Stop" button first before starting a new count down.
Self checklist
Changelist
I have completed sprint 3 alarm clock.