Skip to content

London | 26-ITP-May | Edina Kurdi | Sprint 3 | Alarm clock - #1430

Open
edinakurdi wants to merge 10 commits into
CodeYourFuture:mainfrom
edinakurdi:coursework/sprint-3-alarm-clock
Open

London | 26-ITP-May | Edina Kurdi | Sprint 3 | Alarm clock#1430
edinakurdi wants to merge 10 commits into
CodeYourFuture:mainfrom
edinakurdi:coursework/sprint-3-alarm-clock

Conversation

@edinakurdi

Copy link
Copy Markdown

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

  • updated html to have Alarm clock app tiltle
  • added logic to setAlarm() to grab the user input and display the start time formatted to MM:SS
  • implemented a countdown with setInterval()
  • added a stopping point to clear the interval and play the alarm

@edinakurdi edinakurdi 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 Aug 13, 2026

@cjyuan cjyuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Currently when starting a new countdown, the application does not always return to a clean initial state, which can lead to inconsistent behaviour between runs.

Note: a user may not click the "Stop" button first before starting a new count down.

Comment thread Sprint-3/alarmclock/alarmclock.js Outdated
Comment on lines +14 to +16
const minutes = String(Math.floor(remainingSeconds / 60)).padStart(2, "0");
const seconds = String(remainingSeconds - minutes * 60).padStart(2, "0");
timeRemaining.textContent = `Time Remaining: ${minutes}:${seconds}`;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code on lines 7-10 is very similar to those on lines 14-16.
To adhere to the DRY principle in programming, could you refactor the repeated code into a reusable function?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done.

Comment thread Sprint-3/alarmclock/alarmclock.js Outdated
Comment on lines +2 to +4
const timeInput = document.getElementById("alarmSet");
// console.log(timeInput.value);
let remainingSeconds = timeInput.value;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  • Using raw input without proper validation is a dangerous practice. For number, we should consider

    • What type of number should it be? Integer or floating point number?
    • What range of numbers are acceptable?
    • What kind of invalid value should also be rejected?
  • Unused code and comments should be removed to keep the code clean.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thank you for pointing this out.
Code is updated accordingly.

@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 Aug 14, 2026
@edinakurdi edinakurdi 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 Aug 14, 2026

@cjyuan cjyuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes look good.

const seconds = String(remainingSeconds - minutes * 60).padStart(2, "0");

timeRemaining.textContent = `Time Remaining: ${minutes}:${seconds}`;
timeRemaining.textContent = `Time Remaining: ${timeConvert(remainingSeconds)}`;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could also consider turning this statement into a function:

  • Same code is used on line 27
  • displayTime(remainingSeconds) is probably more readable

@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 Aug 14, 2026
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