Skip to content

Commit 42fe3fc

Browse files
committed
Answer questions on formatTimeDisplay and pad function
1 parent f50de6d commit 42fe3fc

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Sprint-2/4-mandatory-interpret/time-format.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,22 @@ function formatTimeDisplay(seconds) {
1818

1919
// a) When formatTimeDisplay is called how many times will pad be called?
2020
// =============> write your answer here
21+
// It is called 3 times, once for hours, once for minutes, and once for seconds.
2122

2223
// Call formatTimeDisplay with an input of 61, now answer the following:
2324

2425
// b) What is the value assigned to num when pad is called for the first time?
2526
// =============> write your answer here
27+
// The first argument passed to pad is totalHours, which is 0.
2628

2729
// c) What is the return value of pad is called for the first time?
2830
// =============> write your answer here
31+
// The first call to pad returns "00".
2932

3033
// d) What is the value assigned to num when pad is called for the last time in this program? Explain your answer
3134
// =============> write your answer here
35+
// The last call to pad receives num = 1, because remainingSeconds = 61 % 60 = 1.
3236

3337
// e) What is the return value assigned to num when pad is called for the last time in this program? Explain your answer
3438
// =============> write your answer here
39+
// The last call to pad returns "01". The number 1 is converted to a string and padded to two characters with a leading 0.

0 commit comments

Comments
 (0)