Skip to content

Commit 9dcb6ac

Browse files
give a answer to the question in the file 4-mandatory-interpret/time-format.js
1 parent cac70ad commit 9dcb6ac

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

‎Sprint-3/4-mandatory-interpret/time-format.js‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ function formatTimeDisplay(seconds) {
1414

1515
return `${pad(totalHours)}:${pad(remainingMinutes)}:${pad(remainingSeconds)}`;
1616
}
17+
console.log(formatTimeDisplay(61))
1718

1819
// You will need to play computer with this example - use the Python Visualiser https://pythontutor.com/visualize.html#mode=edit
1920
// to help you answer these questions
@@ -22,17 +23,24 @@ function formatTimeDisplay(seconds) {
2223

2324
// a) When formatTimeDisplay is called how many times will pad be called?
2425
// =============> write your answer here
26+
// The pad is called 3 times in step 15.
2527

2628
// Call formatTimeDisplay with an input of 61, now answer the following:
2729

2830
// b) What is the value assigned to num when pad is called for the first time?
2931
// =============> write your answer here
30-
32+
// The value which is assigned to num when pad is called for the first time is 0.
3133
// c) What is the return value of pad when it is called for the first time?
3234
// =============> write your answer here
35+
// The value of pad when it is called for the first time "00"
3336

3437
// d) What is the value assigned to num when pad is called for the last time in this program? Explain your answer
3538
// =============> write your answer here
39+
// The value assign to num is 1.
40+
// because the last call to pad is pad(remainingSeconds), and remainingSeconds is 1
41+
// when formatTimeDisplay(61) is called.
3642

3743
// e) What is the return value of pad when it is called for the last time in this program? Explain your answer
3844
// =============> write your answer here
45+
// The return value is "01" because the last call to pad is pad(1).
46+
// The pad function add a zero to make the number two digits.

0 commit comments

Comments
 (0)