Skip to content

Commit e54e3fc

Browse files
author
Pretty Taruvinga
committed
Trigger alarm immediately when countdown reaches zero"
1 parent 948fa59 commit e54e3fc

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

Sprint-3/alarmclock/alarmclock.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,13 @@ function setAlarm() {
2929
updateDisplay(timeLeft);
3030

3131
timer = setInterval(() => {
32+
timeLeft--;
33+
updateDisplay(timeLeft);
3234
if (timeLeft <= 0) {
3335
clearInterval(timer);
36+
timer = null;
3437
playAlarm();
35-
return;
3638
}
37-
38-
timeLeft--;
39-
updateDisplay(timeLeft);
4039
}, 1000);
4140
}
4241

0 commit comments

Comments
 (0)