Skip to content

Conversation

@asaniDev
Copy link

@asaniDev asaniDev commented Dec 8, 2025

Learners, PR Template

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

Changelist

Added functions to alarm to make the timer count down from input time and alarm to off when it reaches 0.

@asaniDev asaniDev added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. 📅 Sprint 3 Assigned during Sprint 3 of this module Module-Data-Groups The name of the module. labels Dec 8, 2025
playAlarm();
}
displayTime(inputTime);
if (timer) clearInterval(timer);
Copy link
Contributor

Choose a reason for hiding this comment

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

What else should also be reset before starting a new countdown?

function setAlarm() {
inputTime = Number(document.querySelector("#alarmSet").value);

if (Number.isInteger(inputTime) && !isNaN(inputTime) && inputTime >= 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

One of the checks is redundant.

Comment on lines +11 to +15
} else if (inputTime === 0) {
displayTime(inputTime);
playAlarm();
}
displayTime(inputTime);
Copy link
Contributor

Choose a reason for hiding this comment

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

When inputTime is zero, some of your code are unnecessary executed.

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 replacing

   <h1 id="timeRemaining">Time Remaining: 00:00</h1>

by

  <div id="timeRemaining">Time Remaining: <span id="theTime">00:00</span></div>

Suggestion: Use AI to find out why the latter is better.

@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 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Module-Data-Groups The name of the module. Reviewed Volunteer to add when completing a review with trainee action still to take. 📅 Sprint 3 Assigned during Sprint 3 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants