CodeYourFuture / Module-JS2

The central repo for JS2
1 stars 32 forks source link

NW6| Bakhat Begum| Module-JS2 | Js2 alarmclock/week 3 |Week-3 #188

Open BakhatBegum opened 5 months ago

BakhatBegum commented 5 months ago

Learners, PR Template

Self checklist

Changelist

When you click the Set Alarm button the counter at the top of the screen should change to the number you entered in the input field. For example, if the input field says 10 then the title should say Time Remaining: 00:10.

Every one second the title should count down by one.

When the Time Remaining reaches 00:00 the alarm should play a sound. You can make the sound happen by using playAlarm().

You can stop the alarm sound by pressing the Stop Alarm button.

Questions

Q: Why we should not use innerTHML?

netlify[bot] commented 5 months ago

Deploy Preview for cute-gaufre-e4b4e5 ready!

Name Link
Latest commit c8742b905f85a7b74b13259c45358454dea30c14
Latest deploy log https://app.netlify.com/sites/cute-gaufre-e4b4e5/deploys/65ba870e4977cb00083beea9
Deploy Preview https://deploy-preview-188--cute-gaufre-e4b4e5.netlify.app/week-3/alarmclock
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

BakhatBegum commented 5 months ago

Thank you very much for your constructive feedback. I made changes as you instructed.

On Sun, 28 Jan 2024 at 21:04, Musa @.***> wrote:

@.**** commented on this pull request.

In week-3/alarmclock/alarmclock.js https://github.com/CodeYourFuture/Module-JS2/pull/188#discussion_r1468936872 :

+function formatTime(seconds) {

  • const minutes = Math.floor(seconds / 60); // to convert seconds into minutes like, 120/60 = 2 minutes;
  • const remainingSeconds = seconds % 60; // here what if we have remainder like, 75 / 60 = 1 minutes and 15 seconds
  • return ${minutes}:${remainingSeconds < 10 ? '0' : ''}${remainingSeconds}; //this mean when second is < 10 add 0 like, minutes is 3 and second is 5 so the result in string "3:05" +}

Excellent implementation! The formatTime function demonstrates the single responsibility principle. It only focuses on formatting the countdown time, which makes the code easier to understand and maintain. Well done!

In week-3/alarmclock/alarmclock.js https://github.com/CodeYourFuture/Module-JS2/pull/188#discussion_r1468937543 :

  • timer = document.getElementById("alarmSet");
  • countDownSeconds = parseInt(timer.value);

Great work on the code! In this function, you consider adding a validation check to prevent users from entering negative times. Or simply you can use the input for it:

// min="0" will prevent the users entering negative numbers

— Reply to this email directly, view it on GitHub https://github.com/CodeYourFuture/Module-JS2/pull/188#pullrequestreview-1847629595, or unsubscribe https://github.com/notifications/unsubscribe-auth/A7AJUMZUUFR35TRN7R7GHBDYQ24ORAVCNFSM6AAAAABB2JERJWVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTQNBXGYZDSNJZGU . You are receiving this because you authored the thread.Message ID: @.***>