Skip to content

Conversation

@Baba05206
Copy link

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

I implemented the setAlarm() function as per instruction

  • Set Alarm sets Time Remaining to the MM:SS equivalent of the user input in field 'Set time to'
  • The function decrements Time Remaining: every second i.e. counted down by 1 sec
  • When Time Remaining: reaches 00:00, the alarm plays a sound.
  • Stop Alarm stops the alarm sound being played
    Checked for update to the testing framework by running npm install
    Updated the title in the index.html file as per task instruction

Questions

@Baba05206 Baba05206 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 Nov 28, 2025
Copy link
Contributor

@cjyuan cjyuan left a comment

Choose a reason for hiding this comment

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

Can you also keep this branch clean?

Comment on lines +11 to +14
function format(num) {
if (num < 10) return "0" + num;
return num;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not just use String.prototype.padStart()?

Comment on lines +32 to +36
heading.innerText =
"Time Remaining: " +
format(Math.floor(time / 60)) +
":" +
format(time % 60);
Copy link
Contributor

Choose a reason for hiding this comment

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

This code is identical to those on lines 16-20 -- a hint that indicates we could simplify the code.


const heading = document.getElementById("timeRemaining");

clearInterval(intervalId);
Copy link
Contributor

Choose a reason for hiding this comment

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

In addition to clearing intervalId, can you think of anything else that should also be reset before a new countdown starts?


function setAlarm() {
const input = document.getElementById("alarmSet");
let time = Number(input.value);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you think of any potential invalid input that you should prevent?

@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 Nov 29, 2025
@Baba05206 Baba05206 closed this Nov 30, 2025
@Baba05206 Baba05206 deleted the module-data-groups/sprint-3 branch November 30, 2025 08:51
@Baba05206 Baba05206 restored the module-data-groups/sprint-3 branch November 30, 2025 17:16
@Baba05206 Baba05206 deleted the module-data-groups/sprint-3 branch November 30, 2025 17:29
@Baba05206 Baba05206 restored the module-data-groups/sprint-3 branch November 30, 2025 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Module-Data-Groups The name of the module. Reviewed Volunteer to add when completing a review with trainee action still to take. 📅 Sprint 3 Assigned during Sprint 3 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants