Repository navigation
London | 26-ITP-Sep | Chandramani Gaire | Sprint 3 | Alarm clock app #1556
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?
Changes from all commits
8b650ca
cc86ab6
3470b03
7436935
d807e92
e840175
8f149ec
b8be344
6cfa9c8
ee2cf62
ff5790a
8f549e0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,38 @@ | ||
| function setAlarm() {} | ||
| let timer; | ||
| function formatTime(totalSeconds) { | ||
| let minutes = Math.floor(totalSeconds / 60); | ||
| let seconds = totalSeconds % 60; | ||
| return ( | ||
| String(minutes).padStart(2, "0") + ":" + String(seconds).padStart(2, "0") | ||
| ); | ||
| } | ||
| function setAlarm() { | ||
| clearInterval(timer); | ||
| let seconds = Number(document.getElementById("alarmSet").value); | ||
| const title = document.getElementById("timeRemaining"); | ||
|
|
||
| if (!(seconds > 0)) { | ||
| title.innerText = "Time Remaining: 00:00"; | ||
| return; | ||
| } | ||
|
|
||
| title.innerText = "Time Remaining: " + formatTime(seconds); | ||
|
|
||
| timer = setInterval(() => { | ||
| seconds = seconds - 1; | ||
| title.innerText = "Time Remaining: " + formatTime(seconds); | ||
|
|
||
| if (seconds <= 0) { | ||
| clearInterval(timer); | ||
| playAlarm(); | ||
| } | ||
| }, 1000); | ||
| } | ||
|
|
||
| // DO NOT EDIT BELOW HERE | ||
|
|
||
| var audio = new Audio("alarmsound.mp3"); | ||
| let audio = new Audio("alarmsound.mp3"); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How does changing this declaration fit with the To "like" or "dislike" this comment, please follow this link
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes i correction my mistake |
||
|
|
||
| function setup() { | ||
| document.getElementById("set").addEventListener("click", () => { | ||
|
|
||
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.
What happens to the empty
setAlarmdeclaration at the top now that this second declaration has been added?To "like" or "dislike" this comment, please follow this link