-
-
Notifications
You must be signed in to change notification settings - Fork 220
Sheffield | 25-ITP-SEP | Declan Williams | Sprint 3 | Alarm clock #846
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sheffield | 25-ITP-SEP | Declan Williams | Sprint 3 | Alarm clock #846
Conversation
…d decrementing the timer
…d counting down in decrements
…when reaching zero
…unction every 1000ms
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed
Overall, this is definitely a good work. The alarm functionality works well, and your code is readable with clear variable names and helpful comments.
I've left a couple of questions in the code about:
- A bug that occurs when setting multiple alarms
- How to improve readability with magic numbers
Take a look at those comments and let me know what you think. Try to reproduce the bug and see if you can figure out why it happens before checking the solutions.
| } else { | ||
| updatedTime(); | ||
| } | ||
| }, 1000); // updates the function by running it every 1000ms |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, 1000 is what we call a magic number (a value whose meaning isn't immediately obvious). How could you make this number's purpose clearer to someone reading your code?
| @@ -1,4 +1,50 @@ | |||
| function setAlarm() {} | |||
| function setAlarm() { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a bug in your program, suppose the user clicks on the Set Alarm button while the previous alarm is running.
- Why does that happen?
- How would you resolve this?
Learners, PR Template
Self checklist
Changelist
added and implemented lines of code and refactored
ensured that errors throw NaN for when its not a number.