There was an error while loading. Please reload this page.
1 parent 6fc17ad commit 38ee172Copy full SHA for 38ee172
1 file changed
Sprint-3/5-stretch-extend/format-time.js
@@ -40,4 +40,20 @@ function formatAs12HourClock(time){
40
41
return `${String(hours12).padStart(2, "0")}:${minutes} ${period}`;
42
}
43
-console.log(formatAs12HourClock("23:20"))
+console.log(formatAs12HourClock("23:20"))
44
+
45
+function check(input, targetOutput){
46
+ const currentOutput = formatAs12HourClock(input);
47
+ console.assert(currentOutput === targetOutput, `input: ${input}. current output: ${currentOutput}, target output: ${targetOutput}`);
48
+}
49
50
+function checkThrows(input){
51
+ let threw = false;
52
+ try{
53
+ formatAs12HourClock(input);
54
+ }
55
+ catch(error){
56
+ threw = true;
57
58
+ console.assert(threw, `input: ${String(input)} should have thrown an error`);
59
0 commit comments