Skip to content

Commit 0263110

Browse files
exercise 4 solution mandatory-interpret
1 parent c648323 commit 0263110

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,27 @@ function formatTimeDisplay(seconds) {
1111
return `${pad(totalHours)}:${pad(remainingMinutes)}:${pad(remainingSeconds)}`;
1212
}
1313

14+
15+
console.log(formatTimeDisplay(61));
16+
1417
// You will need to play computer with this example - use the Python Visualiser https://pythontutor.com/visualize.html#mode=edit
1518
// to help you answer these questions
1619

1720
// Questions
1821

1922
// a) When formatTimeDisplay is called how many times will pad be called?
20-
// =============> write your answer here
23+
// =============> 3
2124

2225
// Call formatTimeDisplay with an input of 61, now answer the following:
2326

2427
// b) What is the value assigned to num when pad is called for the first time?
25-
// =============> write your answer here
28+
// =============> 0, because totalHours is 0
2629

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

3033
// 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
34+
// =============> 1, because 60 is one minute and the remaining second would be 1 (61)
3235

3336
// 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
37+
// =============> 01, because the remaining seconds are padded 2 index

0 commit comments

Comments
 (0)