Skip to content

Commit c99c22e

Browse files
committed
Update comments in formatTimeDisplay function to provide answers for time formatting questions
1 parent 13ffd18 commit c99c22e

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,23 @@ function formatTimeDisplay(seconds) {
1717
// Questions
1818

1919
// a) When formatTimeDisplay is called how many times will pad be called?
20-
// =============> write your answer here
20+
// =============> 3 times (once for hours, minutes, and seconds)
2121

2222
// Call formatTimeDisplay with an input of 61, now answer the following:
2323

2424
// b) What is the value assigned to num when pad is called for the first time?
25-
// =============> write your answer here
25+
// =============> num = 0
2626

2727
// c) What is the return value of pad is called for the first time?
28-
// =============> write your answer here
28+
// =============> "00"
2929

3030
// d) What is the value assigned to num when pad is called for the last time in this program? Explain your answer
31-
// =============> write your answer here
31+
// =============> num = 1
32+
// (The last call to pad() is for remainingSeconds, which is 1 when seconds = 61)
3233

3334
// e) What is the return value assigned to num when pad is called for the last time in this program? Explain your answer
34-
// =============> write your answer here
35+
// =============> "01"
36+
// (pad() converts 1 to "1" and then pads to two digits, returning "01")
37+
38+
// Example output:
39+
console.log(formatTimeDisplay(61)); // Output: "00:01:01"

0 commit comments

Comments
 (0)