London | May-2026-itp | Vitalii Kmit | Sprint 3 | Alarm clock - #1366
London | May-2026-itp | Vitalii Kmit | Sprint 3 | Alarm clock #1366Vitalii-code wants to merge 6 commits into
Conversation
| @@ -1,4 +1,73 @@ | |||
| function setAlarm() {} | |||
| const oneSecondInMilliseconds = 1000; | |||
There was a problem hiding this comment.
These variables are declared but don't appear to be used anywhere. Are they still needed, or can they be removed to keep the code cleaner?
| stopAlarm(); | ||
|
|
||
| // set up time | ||
| timeLeft = document.getElementById("alarmSet").value; |
There was a problem hiding this comment.
What would happen if I set the alarm for -10 seconds?
|
|
||
| // give a time in seconds | ||
| function formatTime(seconds) { | ||
| minutes = Math.floor(seconds / 60); |
There was a problem hiding this comment.
is minutes supposed to be a global variable?
| minutes = Math.floor(seconds / 60); | ||
| seconds = seconds % 60; | ||
|
|
||
| const seconds_padded = String(seconds).padStart(2, "0"); |
There was a problem hiding this comment.
Does the variable naming convention match style guide?
| // validate result | ||
| const result = parseInt(timeLeft); | ||
| console.log(result); | ||
| if (isNaN(result) || result < 0) { |
There was a problem hiding this comment.
What would happen if I set the alarm to 0 or 2.5 seconds?
| // validate result | ||
| const result = parseInt(timeLeft); | ||
| console.log(result); | ||
| if (isNaN(result) || result < 0 || !Number.isInteger(result)) { |
There was a problem hiding this comment.
The integer validation doesn't seem to be working as expected. What value or type is being passed to Number.isInteger()?
result stores the validated input, but is it being used anywhere after the validation?
Learners, PR Template
Self checklist
Changelist
Worked on the alarm clock