@@ -10,16 +10,25 @@ function formatAs12HourClock(time) {
1010 return `${ time } am` ;
1111}
1212
13+ //Test cases
1314const currentOutput = formatAs12HourClock ( "08:00" ) ;
1415const targetOutput = "08:00 am" ;
15- console . assert (
16- currentOutput === targetOutput ,
17- `current output: ${ currentOutput } , target output: ${ targetOutput } `
18- ) ;
16+ console . assert ( currentOutput === targetOutput , `current output: ${ currentOutput } , target output: ${ targetOutput } ` ) ;
1917
2018const currentOutput2 = formatAs12HourClock ( "23:00" ) ;
2119const targetOutput2 = "11:00 pm" ;
22- console . assert (
23- currentOutput2 === targetOutput2 ,
24- `current output: ${ currentOutput2 } , target output: ${ targetOutput2 } `
25- ) ;
20+ console . assert ( currentOutput2 === targetOutput2 , `current output: ${ currentOutput2 } , target output: ${ targetOutput2 } ` ) ;
21+
22+
23+ const currentOutput3 = formatAs12HourClock ( "00:00" ) ;
24+ const targetOutput3 = "12:00 am" ;
25+ console . assert ( currentOutput3 === targetOutput3 , `current output: ${ currentOutput3 } , target output: ${ targetOutput3 } ` ) ;
26+
27+
28+ const currentOutput4 = formatAs12HourClock ( "00:00" ) ;
29+ const targetOutput4 = "12:00 am" ;
30+ console . assert ( currentOutput4 === targetOutput4 , `current output: ${ currentOutput4 } , target output: ${ targetOutput4 } ` ) ;
31+
32+ const currentOutput5 = formatAs12HourClock ( "15:01" ) ;
33+ const targetOutput5 = "3:01 pm" ;
34+ console . assert ( currentOutput5 === targetOutput5 , `current output: ${ currentOutput5 } , target output: ${ targetOutput5 } ` ) ;
0 commit comments