File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Sprint-2/4-mandatory-interpret Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -18,17 +18,35 @@ function formatTimeDisplay(seconds) {
1818
1919// a) When formatTimeDisplay is called how many times will pad be called?
2020// =============> write your answer here
21+ // Answer: 3 times
22+ // pad(totalHours)
23+ // pad(remainingMinutes)
24+ // pad(remainingSeconds)
2125
2226// Call formatTimeDisplay with an input of 61, now answer the following:
2327
2428// b) What is the value assigned to num when pad is called for the first time?
2529// =============> write your answer here
30+ // pad(num) = pad(0) = 0
2631
2732// c) What is the return value of pad is called for the first time?
2833// =============> write your answer here
34+ // pad(num) = pad(0) = "00"
2935
3036// d) What is the value assigned to num when pad is called for the last time in this program? Explain your answer
3137// =============> write your answer here
38+ // Answer: pad(num) = pad(1) = 1
39+ // Explanation below:
40+ // Last call: pad(remainingSeconds)
41+ // remainingSeconds = 1
42+ // pad(1) → num = 1
3243
3344// e) What is the return value assigned to num when pad is called for the last time in this program? Explain your answer
3445// =============> write your answer here
46+ // Answer: pad(num) = pad(1) = "01"
47+ // Explanation below:
48+ // Last call: pad(remainingSeconds)
49+ // remainingSeconds = 1
50+ // toString() → "1"
51+ // "1".padStart(2, "0") → "01"
52+ // pad(1) → "01"
You can’t perform that action at this time.
0 commit comments