Skip to content

Conversation

@Fithi-Teklom
Copy link

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

@Fithi-Teklom Fithi-Teklom added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Dec 6, 2025
@JaypeeLan JaypeeLan added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Dec 7, 2025
const input = document.getElementById("alarmSet").value;
const parsed = parseInt(input, 10);

if (isNaN(parsed) || parsed < 0) return;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should check for an empty value first. Also alert an error if any.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hello, can you please review my PR again it has been a while. step 3 has not approved because this PR is still in needs review

@JaypeeLan JaypeeLan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Dec 7, 2025
@Fithi-Teklom Fithi-Teklom added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Dec 10, 2025
Copy link
Contributor

@cjyuan cjyuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation is a bit off. Can you improve the indentation?

Comment on lines 54 to 65
timer = setInterval(() => {
if (timeLeft > 0) {
timeLeft--;
updateDisplay(timeLeft);
}

if (timeLeft === 0) {
clearInterval(timer);
startAlarm();
}
}, 1000);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The alarm will start 1 second after the alarm is set when the input is either 0 or 1.
That is, when the input is zero, the alarm will only start 1 second afterward (and not immediately).
Can you improve the consistency?

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Dec 17, 2025
@Fithi-Teklom Fithi-Teklom added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Dec 18, 2025
Copy link
Contributor

@cjyuan cjyuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you improve the indentation of the code in this file?

VSCode has a built-in "Format document" feature that can be used to automatically indent JS code.

  1. Need to install "prettier" VSCode extension first.
  2. To auto-indent JS code, right-click in the editor and select "Format document" to format the code in the editor.

Comment on lines 50 to 55
clearInterval(timer);
clearInterval(flashing); // stop flashing if it was active
flashing = null;
document.body.style.backgroundColor = "";
pauseAlarm(); // stop any playing audio
audio.currentTime = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could consider placing this "reset" code in a function and call the function here.

Comment on lines 68 to 69
tick();
timer = setInterval(tick, 1000);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering the following two cases:

Case 1: When the input is 0 (i.e., timeLeft is 0)
Line 69 will also be executed, resulting the code on line 62-63 being executed twice.

Case 2: When the input is 1 (i.e., timeLeft is 1)
Line 68 is executed, causing the display to show "00:00" immediately (instead of showing "00:01").
But startAlarm() is only executed one second afterward.
(Ideally, the alarm could sound as soon as the display show "00:00")

Suggestion: Since 0 is such a special case, you can consider doing something like

if (timeLeft === 0) {


}
else { // Other other cases


}

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Dec 18, 2025
@Fithi-Teklom Fithi-Teklom added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Dec 18, 2025
Copy link
Contributor

@cjyuan cjyuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good.

@cjyuan cjyuan added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Dec 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Complete Volunteer to add when work is complete and all review comments have been addressed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants