Skip to content

Commit fc92b97

Browse files
committed
wrapped an implementation inside a function
1 parent b6af9d4 commit fc92b97

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Sprint-3/alarmclock/alarmclock.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,17 @@ function setAlarm() {
4242
updateDisplay(timeLeft);
4343

4444
// Clear previous countdown
45+
function resetAlarmState() {
4546
clearInterval(timer);
46-
clearInterval(flashing); // stop flashing if it was active
47+
clearInterval(flashing);
4748
flashing = null;
4849
document.body.style.backgroundColor = "";
49-
pauseAlarm(); // stop any playing audio
50+
pauseAlarm();
5051
audio.currentTime = 0;
52+
}
53+
54+
resetAlarmState();
55+
5156

5257
function tick() {
5358
if (timeLeft > 0) {

0 commit comments

Comments
 (0)