File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
Sprint-2/4-mandatory-interpret Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -17,18 +17,22 @@ 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, once for minutes, and once for 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+ // ===> 0 — the first pad call is for totalHours, which is 0 when input is 61
2626
27- // c) What is the return value of pad is called for the first time?
28- // =============> write your answer here
27+ // c) What is the return value of pad when called for the first time?
28+ // ===> "00" — because pad(0) returns the string "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+ // ===> 1 — the last pad call is for remainingSeconds, which is 61 % 60 = 1
3232
3333// 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
34+ // ===> "01" — because pad(1) turns 1 into "01" using padStart(2, "0")
35+
36+ // Example run:
37+ console . log ( formatTimeDisplay ( 61 ) ) ; // Output: "00:01:01"
38+
You can’t perform that action at this time.
0 commit comments