Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
2c983b7
Updated code for median.js to pass the late expectations
Jul 20, 2026
6c109e9
Added code to dedupe.js
Jul 20, 2026
d57add3
added code for max.js
Jul 20, 2026
e3befbb
Added code to sum.js
Jul 20, 2026
872ddf0
modified code on includes.js to use a for...of loop
Jul 21, 2026
6c28930
Changed code in address. js to specify houseNumber
Jul 21, 2026
bbf0a73
Updated code and added notes for author.js
Jul 21, 2026
5c2b4b5
update the code and added notes to recipe.js
Jul 21, 2026
663412b
Added code and tests for contains.js
Jul 23, 2026
4c0d767
added code to lookup.test
Jul 23, 2026
827b052
added code and passed tests for querystring.test.js
Jul 28, 2026
2c0a94c
added code and tests for tally.test and js
Jul 28, 2026
f583fd7
updated tests output for tally.test
Jul 29, 2026
93df342
added answers to invert.js and added a .test.js page to
Jul 29, 2026
1461d83
Changed title element in index to ' Alarm Clock App'
Jul 29, 2026
7d18e63
Update code for "alarmclock.js"
Jul 29, 2026
c3f2ae0
added line in alarmclock.js
Jul 29, 2026
6c5b139
Added title in quotes.index.html
Jul 29, 2026
09a5ef1
added code to alarmclock
Jul 29, 2026
aded465
Updated code for alarmclock.js
Aug 1, 2026
88a4388
removed previous code in order to pass criteria
Aug 6, 2026
7c56088
removed prep folder
Aug 6, 2026
ca5b7aa
Merge branch 'main' into sprint-3-alarm-clock
JorvanW Aug 6, 2026
5f6e65e
updated median.js
Aug 6, 2026
8305bfe
added missing file
Aug 8, 2026
7f10e87
changed unecessary file
Aug 8, 2026
2a57b48
udpated code so alarm sound also resets when the user presses set ala…
Aug 13, 2026
07a6401
change a line to code to specify that seconds has to be a whole number
Aug 13, 2026
5eb8640
added "whole number" in alert message
Aug 13, 2026
437f9bc
updated html and js file for alarm clock
Aug 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 37 additions & 1 deletion Sprint-3/alarmclock/alarmclock.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,40 @@
function setAlarm() {}
const theTime = document.getElementById("theTime");
let timer;
let seconds;

function setAlarm() {
const alarmSetInput = document.getElementById("alarmSet");
seconds = Number(alarmSetInput.value);

if (seconds <= 0 || !Number.isInteger(seconds)) {
alert("Please enter a valid whole number.");
return;
}

// Stop a previous countdown if there is one
clearInterval(timer);
pauseAlarm();

// Run immediately
decrementTimer();

// decrement each second
timer = setInterval(() => decrementTimer(), 1000);
}

function decrementTimer() {
const minutes = Math.floor(seconds / 60);
const secs = seconds % 60;

theTime.textContent = `${String(minutes).padStart(2, "0")}:${String(secs).padStart(2, "0")}`;
if (seconds <= 0) {
clearInterval(timer);
playAlarm();
return;
}

seconds--;
}

// DO NOT EDIT BELOW HERE

Expand Down
5 changes: 3 additions & 2 deletions Sprint-3/alarmclock/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="style.css" />
<title>Title here</title>
<title>Alarm Clock App</title>
</head>
<body>
<div class="centre">
<h1 id="timeRemaining">Time Remaining: 00:00</h1>
<div id="timeRemaining">Time Remaining: <span id="theTime">00:00</span></div>

<label for="alarmSet">Set time to:</label>
<input id="alarmSet" type="number" />

Expand Down
Loading