We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e54e3fc commit ae98f15Copy full SHA for ae98f15
Sprint-3/alarmclock/alarmclock.js
@@ -1,4 +1,3 @@
1
-let timeLeft = 0;
2
let timer = null;
3
4
function formatTime(seconds) {
@@ -13,6 +12,7 @@ function updateDisplay(timeLeft) {
13
12
}
14
15
function setAlarm() {
+ let timeLeft = 0;
16
const input = document.getElementById("alarmSet").value;
17
18
timeLeft = parseInt(input, 10);
@@ -31,6 +31,7 @@ function setAlarm() {
31
timer = setInterval(() => {
32
timeLeft--;
33
updateDisplay(timeLeft);
34
+
35
if (timeLeft <= 0) {
36
clearInterval(timer);
37
timer = null;
0 commit comments