Skip to content

London | 26-ITP-May | Dipa Sarker | Sprint 3 | Alarm Clock App - #1294

Open
Dipa-Sarker wants to merge 4 commits into
CodeYourFuture:mainfrom
Dipa-Sarker:Sprint-3/alarm-clock
Open

London | 26-ITP-May | Dipa Sarker | Sprint 3 | Alarm Clock App#1294
Dipa-Sarker wants to merge 4 commits into
CodeYourFuture:mainfrom
Dipa-Sarker:Sprint-3/alarm-clock

Conversation

@Dipa-Sarker

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

Implemented the alarm clock functionality with countdown and alarm controls.

** Changes made**

  • Added functionality for the Set Alarm button to start the countdown from the entered time.
  • Updated the timer display to show the remaining time in "mm:ss" format.
  • Added a countdown that decreases every second.
  • Triggered the alarm sound when the timer reaches "00:00".
  • Added Stop Alarm button functionality to stop the alarm sound and stop countdown after certain time.

I also tested the functions to works the app properly.

@Dipa-Sarker Dipa-Sarker added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 26, 2026
@LonMcGregor LonMcGregor added the Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. label Jul 27, 2026

@LonMcGregor LonMcGregor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Good start on this task, there is still some work to do however

Comment thread Sprint-3/alarmclock/alarmclock.js
.padStart(2, "0");
const showTimeSeconds = (remainingTime % 60).toString().padStart(2, "0");
timeRemainingElement.innerText = showTimeMinutes + ":" + showTimeSeconds;
if (remainingTime === 0) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Do you properly finish the timer countdown after it hits zero?

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.

Sorry, I am unclear about your question. But I think I finished the countdown after hitting zero at here:

function countDown() {
if (remainingTime <= 0) {
clearInterval(intervalID);
triggerAlarm();
return;
}

Which means:

  • Timer reaches 00:00
  • Interval stops
  • No negative counting
  • Alarm starts
  • returns from the code so no extra code runs afterward.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I see, I was confused that you have a triggerAlarm in the setAlarm function. if you also have it in the countDown function, is it necessary to have it in the setAlarm function also?

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.

if (remainingTime <= 0) {
clearInterval(intervalID);
triggerAlarm();
return;
}
this condition serves different purpose inside setAlarm() function. I commented out every possible confusing condition in my code. Please let me know if there any confusion again.


let remainingTime;
let intervalID;
function triggerAlarm() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

A bit more spacing between functions / improved formatting would help readability.

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.

Actually, I used prettier tool according to the style guide for formatting. Should I provide extra spaces in between functions?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

A clear line between functions is a good idea

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.

I placed one line inside functions.

Comment thread Sprint-3/alarmclock/alarmclock.js Outdated
window.onload = setup;

const timeRemainingElement = document.querySelector("#timeRemaining");
const alarmSetElement = document.querySelector("#alarmSet");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

If you know you are using IDs, can you think of something better tha n querySelector?

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.

Is it getelementID()?

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.

Replaced every querySelector() by getElementID().

@LonMcGregor LonMcGregor 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. Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Jul 27, 2026
@Dipa-Sarker Dipa-Sarker 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 Jul 30, 2026

@LonMcGregor LonMcGregor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Good improvement with the input validation, almost complete with the other tasks

.padStart(2, "0");
const showTimeSeconds = (remainingTime % 60).toString().padStart(2, "0");
timeRemainingElement.innerText = showTimeMinutes + ":" + showTimeSeconds;
if (remainingTime === 0) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I see, I was confused that you have a triggerAlarm in the setAlarm function. if you also have it in the countDown function, is it necessary to have it in the setAlarm function also?


let remainingTime;
let intervalID;
function triggerAlarm() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

A clear line between functions is a good idea

@LonMcGregor LonMcGregor 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 1, 2026
@Dipa-Sarker Dipa-Sarker 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 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants