@@ -21,41 +21,18 @@ function formatTimeDisplay(seconds) {
2121// Questions
2222
2323// a) When formatTimeDisplay is called how many times will pad be called?
24- // =============> write your answer here: three calls to pad() in the return statement:
25- //return `${pad(totalHours)}:${pad(remainingMinutes)}:${pad(remainingSeconds)}`;
24+ // =============> write your answer here
2625
2726// Call formatTimeDisplay with an input of 61, now answer the following:
2827
2928// b) What is the value assigned to num when pad is called for the first time?
30- // =============> write your answer here:
31- //For formatTimeDisplay(61):
32- //remainingSeconds = 61 % 60 = 1
33- //totalMinutes = (61 - 1) / 60 → 1
34- //remainingMinutes = 1 % 60 → 1
35- //totalHours = (1 - 1) / 60 → 0
36- //num = 1
29+ // =============> write your answer here
3730
3831// c) What is the return value of pad when it is called for the first time?
39- // =============> write your answer here:num is 0.
40- //let numString = num.toString(); gives us 0
41-
42- // This loop adds a "0" because the string has only one character:
43- //numString = "0" + "0";
44- //return value is:
45- //"00"
32+ // =============> write your answer here
4633
4734// d) What is the value assigned to num when pad is called for the last time in this program? Explain your answer
48- // =============> write your answer here:
49- //The last call is: pad(remainingSeconds)
50-
51- //For 61 seconds, remainingSeconds is 61 % 60 = 1:
52- //so num = 1
35+ // =============> write your answer here
5336
5437// e) What is the return value of pad when it is called for the last time in this program? Explain your answer
55- // =============> write your answer here:
56- //num is 1, so:
57- //num.toString() gives "1".
58-
59- // and this loop adds a 0 to the beginning: "01"
60-
61- //So the final result of formatTimeDisplay(61) is: 00:01:01
38+ // =============> write your answer here
0 commit comments