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 ee63ed7 commit b4bde21Copy full SHA for b4bde21
Sprint-3/alarmclock/alarmclock.js
@@ -11,20 +11,24 @@ function updateDisplay() {
11
12
function startCountdown() {
13
timerId = setInterval(() => {
14
- remainingSeconds -= 1;
+
15
updateDisplay();
16
- if (remainingSeconds === 0) {
+ if (remainingSeconds <= 0) {
17
remainingSeconds = 0;
18
clearInterval(timerId);
19
timerId = null;
20
playAlarm();
21
}
22
+ remainingSeconds -= 1;
23
}, 1000);
24
25
26
function setAlarm() {
27
const input = document.getElementById("alarmSet");
28
+ if (input.value==="")return;
29
const inputValue = Number(input.value);
30
31
32
33
34
remainingSeconds = inputValue;
0 commit comments