Skip to content

Sheffield | ITP-Jan-26 | Mahammad Osman | Sprint 3 | Alarm Clock#1162

Open
Darkidd77 wants to merge 3 commits intoCodeYourFuture:mainfrom
Darkidd77:Alarm-Clock
Open

Sheffield | ITP-Jan-26 | Mahammad Osman | Sprint 3 | Alarm Clock#1162
Darkidd77 wants to merge 3 commits intoCodeYourFuture:mainfrom
Darkidd77:Alarm-Clock

Conversation

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

  • Connected the HTML inputs to the setAlarm function.
  • Implemented the countdown engine using setInterval (1000ms delay).
  • Added logic to mathematically split raw seconds into minutes and seconds, formatted to MM:SS using .padStart(2, '0').
  • Added safety checks to clearInterval both when the timer hits zero, and if the user clicks "Set Alarm" while a timer is already running.

@Darkidd77 Darkidd77 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Apr 2, 2026
@Luro91 Luro91 added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Apr 4, 2026
const headingElement = document.getElementById("timeRemaining");

if (!inputElement.value) {
return;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It's important to validate user input.

What happens if a user enters a negative value?
How could you give feedback to the user about the input not being valid?

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.

Yes, I realised that I have to validate the input to avoid unexpected actions from the code, as if it's negative values it trigger the alarm as its less than zero, i did added a check after parsing the input to make sure its not negative and not a NaN and return a message informing the user to input a valid value. Thank you

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You could remove the condition for checking "!inputElement.value" now and save some line of codes.

}, 1000);
}

function flashScreen() {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nice bonus implementation of the flashing screen

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

@Luro91 Luro91 added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Apr 4, 2026
@Darkidd77 Darkidd77 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Apr 6, 2026
@Luro91 Luro91 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 Apr 7, 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants