Skip to content

Commit 512d598

Browse files
committed
Fix input validation
1 parent d53501a commit 512d598

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎Sprint-3/alarmclock/alarmclock.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ function setAlarm() {
1313
display = document.getElementById("timeRemaining");
1414

1515
// validate result
16-
const result = parseInt(timeLeft);
17-
console.log(result);
18-
if (isNaN(result) || result < 0 || !Number.isInteger(result)) {
16+
const result = Number(timeLeft);
17+
if (!Number.isInteger(result) || result < 0) {
1918
return;
2019
}
20+
timeLeft = result;
2121

2222
display.textContent = formatTime(timeLeft);
2323

0 commit comments

Comments
 (0)