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 0f8a136 commit a04f01cCopy full SHA for a04f01c
1 file changed
Sprint-3/alarmclock/alarmclock.js
@@ -16,26 +16,21 @@ function setAlarm() {
16
const input = document.getElementById("alarmSet");
17
let time = Number(input.value);
18
19
- // Always reset first so old countdown stops
20
resetAlarm();
21
22
- // Validate input (reject decimals, negatives, NaN)
23
if (isNaN(time) || time < 0 || !Number.isInteger(time)) {
24
showError("Please enter a whole number of seconds.");
25
return;
26
}
27
28
- // If time is 0, trigger alarm immediately
29
if (time === 0) {
30
updateHeading(0);
31
playAlarm();
32
33
34
35
- // Show starting time
36
updateHeading(time);
37
38
- // Start countdown
39
countdown = setInterval(() => {
40
time--;
41
0 commit comments