Skip to content

Commit a3583cf

Browse files
committed
answered questions
1 parent 21b30d7 commit a3583cf

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,31 @@ function formatTimeDisplay(seconds) {
1919
// a) When formatTimeDisplay is called how many times will pad be called?
2020
// =============> write your answer here
2121

22+
// Answer: 3 times
23+
// pad(totalHours)
24+
// pad(remainingMinutes)
25+
// pad(remainingSeconds)
26+
27+
2228
// Call formatTimeDisplay with an input of 61, now answer the following:
2329

2430
// b) What is the value assigned to num when pad is called for the first time?
2531
// =============> write your answer here
32+
pad(num) = pad(0) = 0
2633

2734
// c) What is the return value of pad is called for the first time?
2835
// =============> write your answer here
36+
pad(num) = pad(0) = "00"
2937

3038
// d) What is the value assigned to num when pad is called for the last time in this program? Explain your answer
3139
// =============> write your answer here
40+
// pad(num) = pad(1) = 1
41+
42+
//Explanation
43+
// Last call: pad(remainingSeconds)
44+
// remainingSeconds = 1
45+
// pad(1) → num = 1
3246

3347
// e) What is the return value assigned to num when pad is called for the last time in this program? Explain your answer
3448
// =============> write your answer here
49+
// pad(num) = pad(1) = "01" because the pad function converts the number to a string and pads it with a leading zero if it's only one digit long.

0 commit comments

Comments
 (0)