Skip to content

London | 26-ITP-May | Khaliun Baatarkhuu | Sprint 3 | Alarm Clock - #1372

Open
khaliun-dev wants to merge 6 commits into
CodeYourFuture:mainfrom
khaliun-dev:sprint-3/alarm-clock
Open

London | 26-ITP-May | Khaliun Baatarkhuu | Sprint 3 | Alarm Clock#1372
khaliun-dev wants to merge 6 commits into
CodeYourFuture:mainfrom
khaliun-dev:sprint-3/alarm-clock

Conversation

@khaliun-dev

Copy link
Copy Markdown

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

Implemented new code in alarmcode.js file.

  • reading the time from the input field
  • update seconds
  • play the alarm sound

Updated the page title in index.html to "Alarm clock app".

Questions

None.

Added displayTime function to show remaining time and updated setAlarm to utilize it.
@khaliun-dev khaliun-dev added 📅 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 3, 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
}

function setAlarm() {
let time = parseInt(document.getElementById("alarmSet").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.

Are there any values that need to be rejected to ensure the app works properly?

@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 8, 2026
Refactor alarm time parsing to use parseInt and clean up code.
Add validation to ensure alarm time is a positive integer.
@khaliun-dev

Copy link
Copy Markdown
Author

@cjyuan i have implemented new code to reject negative numbers and accept whole number only. Also i made sure the old countdown stops before the new one starts.

@khaliun-dev khaliun-dev added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 8, 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.

After the previous countdown had finished, what would happen if a user started a new countdown without clicking the "Stop Alarm" button first?

Comment on lines +33 to +35
document.getElementById("stop").addEventListener("click", () => {
clearInterval(interval);
});

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.

Good touch.

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.

@cjyuan I think i figured it out , the sound for the alarm wasn't stopping when the timer restarts, i have added pauseAlarm to solve that

@cjyuan cjyuan removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 8, 2026
@khaliun-dev khaliun-dev added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 8, 2026
@cjyuan

cjyuan commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

All good. Well done!

@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. Reviewed Volunteer to add when completing a review with trainee action still to take. labels Aug 8, 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. 📅 Sprint 3 Assigned during Sprint 3 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants