-
-
Notifications
You must be signed in to change notification settings - Fork 147
Sheffield|May-2025|Sheida Shabankari|Module-Data -Groups| Sprint-3|Alarm Clock #631
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
base: main
Are you sure you want to change the base?
Conversation
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.
-
Code works fine if a user only clicks the "Set Alarm" button once.
However, if the user enters a time and then clicks the "Set Alarm" button multiple times, the countdown clock will not display properly.
Can you fix the issue? -
Some of the function definitions appear twice. Can you remove the unwanted copies?
-
We should respect instructions like
DO NOT EDIT BELOW HERE
; it is usually there for a reason. If you are curious about why, you can ask ChatGPTWhy should programmers respect "DO NOT EDIT BELOW HERE" instruction in a file?
(You don't have to undo the changes you made this time, I just want to raise your awareness)
@@ -1,5 +1,98 @@ | |||
function setAlarm() {} | |||
var flashColor; |
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.
Why use var
instead of let
?
if (inputTime <= 0 || isNaN(inputTime)) { | ||
alert("invalid input!!!"); | ||
return; | ||
} |
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.
Some unusual input values that can make your app behave abnormally can still pass this check. Can you add code to sanitise them?
let min = String(Math.floor(inputTime / 60)).padStart(2, "0"); | ||
let sec = String(inputTime % 60).padStart(2, "0"); |
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.
Can consider declaring these two variables with const
because they won't be reassigned any value.
document.getElementById("stop").style.backgroundColor = "rgb(191, 115, 47)"; | ||
document.body.style.backgroundColor = "rgb(218, 178, 119)"; | ||
let flashColor=setInterval(() => { | ||
if(document.body.style.backgroundColor === "rgb(218, 178, 119)"){ | ||
document.body.style.backgroundColor = "white"; | ||
}else{ | ||
document.body.style.backgroundColor = "rgb(218, 178, 119)"; |
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.
Could consider preparing several CSS classes in a CSS file and then assign/remove CSS class to these element to change their appearance. This way, if we want to change the styles (including color), we don't have to modify the JS code.
Self checklist
I have done all requirements for setting an alarm clock step by step and passed all the tests.