Skip to content

Commit a2d1980

Browse files
committed
Remove setTimout to pass all tests
1 parent 1e6f60f commit a2d1980

1 file changed

Lines changed: 1 addition & 7 deletions

File tree

‎Sprint-3/alarmclock/alarmclock.js‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ let intervalID;
66
let timeoutID;
77
let display;
88

9-
// document.getElementById("set").addEventListener("click", setAlarm);
10-
// document.getElementById("stop").addEventListener("click", stopAlarm);
11-
129
function setAlarm() {
1310
stopAlarm();
1411

@@ -24,10 +21,6 @@ function setAlarm() {
2421

2522
display.textContent = formatTime(timeLeft);
2623

27-
if (!timeoutID) {
28-
timeoutID = setTimeout(alarmFinished, timeLeft * oneSecondInMilliseconds);
29-
}
30-
3124
if (!intervalID) {
3225
intervalID = setInterval(updateTimer, 1000);
3326
}
@@ -41,6 +34,7 @@ function updateTimer() {
4134
display.textContent = formatTime(timeLeft);
4235

4336
if (timeLeft <= 0) {
37+
alarmFinished();
4438
cleanUp();
4539
}
4640
}

0 commit comments

Comments
 (0)