Skip to content

Conversation

@Iswanna
Copy link

@Iswanna Iswanna commented Nov 20, 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

In this pull request, I completed the alarm clock project by implementing the setAlarm functionality with input validation, a live countdown in mm:ss format, and alarm sound at 00:00. I added a helper function to update the display, clear the input, and change the background color when the countdown finishes.

Questions

Hi. Please could you review my PR? I’d really appreciate your feedback.

@Iswanna Iswanna added 🏕 Priority Mandatory This work is expected 📅 Sprint 3 Assigned during Sprint 3 of this module Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Module-Data-Groups The name of the module. labels Nov 20, 2025
@jaymes15 jaymes15 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 Nov 22, 2025
@jaymes15 jaymes15 self-requested a review November 22, 2025 12:09
let intervalId;

// Helper function to format total seconds and update the UI
function updateDisplay(totalSeconds) {

Choose a reason for hiding this comment

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

Nice use of a helper function @Iswanna

Separating the display formatting into its own function is excellent practice and keeps setAlarm() cleaner.

Copy link
Author

Choose a reason for hiding this comment

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

Thank you for the feedback @jaymes15.

let totalSeconds = Number(inputElement.value); //this converts the input from string to number

// Validate input
if (totalSeconds <= 0 || isNaN(totalSeconds)) {

Choose a reason for hiding this comment

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

Good validation!

Copy link
Author

Choose a reason for hiding this comment

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

Thank you!

// the code you write here will run every one second or 1000 milliseconds
totalSeconds = totalSeconds - 1;
if (totalSeconds <= 0) {
clearInterval(intervalId);

Choose a reason for hiding this comment

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

Correct use of clearInterval

Copy link
Author

Choose a reason for hiding this comment

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

Thank you

clearInterval(intervalId);
playAlarm();
document.getElementById("timeRemaining").textContent =
"Time Remaining: 00:00";

Choose a reason for hiding this comment

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

@Iswanna Can you think of a way to avoid having Time Remaining: in multiple places in your code

Copy link
Author

@Iswanna Iswanna Nov 22, 2025

Choose a reason for hiding this comment

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

@jaymes15, if I store Time Remaining: in a global variable, would that be okay?

Choose a reason for hiding this comment

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

That works @Iswanna

@jaymes15 jaymes15 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 Nov 22, 2025
@Iswanna Iswanna 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 Nov 22, 2025
@Iswanna Iswanna requested a review from jaymes15 November 22, 2025 13:49
@Iswanna
Copy link
Author

Iswanna commented Nov 23, 2025

Hi @jaymes15 . I have updated my code with the changes. Please kindly review my PR. Thank you.

@jaymes15 jaymes15 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 Nov 23, 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. Module-Data-Groups The name of the module. 🏕 Priority Mandatory This work is expected 📅 Sprint 3 Assigned during Sprint 3 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants