Skip to content

Commit 1f028f7

Browse files
committed
Define a function to convert argument to time with "am" and add bassertions to compare current output with target output
1 parent 86552fe commit 1f028f7

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed
Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,25 @@
1-
const calculation = 10 + 32;
2-
const result = 40;
1+
// const calculation = 10 + 32;
2+
// const result = 40;
33
// console.assert(calculation === result);
44

5-
function formatAs12HourClock() {}
6-
console.log(formatAs12HourClock())
7-
console.assert(formatAs12HourClock("08:00") === "08:00 am" , `current output: ${formatAs12HourClock("08:00")} , target output: 08:00 am`);
5+
// function formatAs12HourClock() {}
6+
// console.log(formatAs12HourClock())
7+
// console.assert(formatAs12HourClock("08:00") === "08:00 am" , `current output: ${formatAs12HourClock("08:00")} , target output: 08:00 am`);
8+
9+
function formatAs12HourClock(time) {
10+
return `${time} am`;
11+
}
12+
13+
const currentOutput = formatAs12HourClock("08:00");
14+
const targetOutput = "08:00 am";
15+
console.assert(
16+
currentOutput === targetOutput,
17+
`current output: ${currentOutput}, target output: ${targetOutput}`
18+
);
19+
20+
const currentOutput1 = formatAs12HourClock("23:00");
21+
const targetOutput1 = "11:00 pm";
22+
console.assert(
23+
currentOutput === targetOutput,
24+
`current output: ${currentOutput}, target output: ${targetOutput}`
25+
);

0 commit comments

Comments
 (0)