Skip to content

Commit f057c76

Browse files
Created logical AND to check for finshsed timer
1 parent f9ad3be commit f057c76

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎Sprint-3/alarmclock/alarmclock.js‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ function setAlarm() {
1414
}
1515

1616
timeRemaining = seconds;
17+
isPaused = false;
1718
updateDisplay(timeRemaining);
1819

1920
// Clear any previous countdown
@@ -33,6 +34,7 @@ function startCountdown(){
3334
if (timeRemaining <= 0) {
3435
clearInterval(intervalId);
3536
intervalId = null;
37+
isPaused =true;
3638
playAlarm();
3739
document.body.classList.add("flash");
3840
}
@@ -50,7 +52,7 @@ function updateDisplay(seconds) {
5052
title.textContent = `Time Remaining: ${mins}:${secs}`;
5153
}
5254
function togglePause() {
53-
if (intervalId === null) {
55+
if (intervalId === null && !isPaused) {
5456
return;
5557
}
5658
if (!isPaused) {

0 commit comments

Comments
 (0)