Skip to content

Commit 1050f5d

Browse files
committed
format-time code refactored
1 parent f70662a commit 1050f5d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,14 @@ function formatAs12HourClock(time) {
2121

2222
if (hours == 0 || hours == 24) {
2323
return `12:${pad(minutes)} am`;
24-
} else if (hours > 12) {
24+
}
25+
if (hours > 12) {
2526
return `${pad(hours - 12)}:00 pm`;
26-
} else if (hours == 12) {
27+
}
28+
if (hours == 12) {
2729
return `${time} pm`;
28-
} else return `${time} am`;
30+
}
31+
return `${time} am`;
2932
}
3033

3134
let currentOutput = formatAs12HourClock("08:00");

0 commit comments

Comments
 (0)