Skip to content

Commit 029c9bc

Browse files
committed
Used const instead of let in formatAs12HourClock
1 parent 8fb5a39 commit 029c9bc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Sprint-2/5-stretch-extend/format-time.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
function formatAs12HourClock(time) {
66
// Expect time in "HH:MM" format
7-
let hours = Number(time.slice(0, 2));
8-
let mins = time.slice(3);
7+
const hours = Number(time.slice(0, 2));
8+
const mins = time.slice(3);
99

1010
if (hours === 0) {
1111
return `12:${mins} am`;
@@ -16,7 +16,7 @@ function formatAs12HourClock(time) {
1616
}
1717

1818
if (hours > 12) {
19-
let newHr = hours - 12;
19+
const newHr = hours - 12;
2020
// pad single digits like 1:00 -> 01:00
2121
return `${String(newHr).padStart(2, "0")}:${mins} pm`;
2222
}

0 commit comments

Comments
 (0)