Skip to content

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

Open
Dipa-Sarker wants to merge 2 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 2 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

bodyElement.style.backgroundColor = "yellow";
alarmSoundElement.play();
}
function setAlarm() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Have you properly handled the input validation here?

@Dipa-Sarker Dipa-Sarker Jul 30, 2026

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.

No, I didn't handle input validation. Now I have tried with empty input and input time < 0.

.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.


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?

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()?

@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
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