Skip to content

Commit 2eaa851

Browse files
solved the mandatory interpret
1 parent d424070 commit 2eaa851

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

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

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

14+
console.log(formatTimeDisplay(60))
1415
// You will need to play computer with this example - use the Python Visualiser https://pythontutor.com/visualize.html#mode=edit
1516
// to help you answer these questions
1617

1718
// Questions
1819

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

2223
// Call formatTimeDisplay with an input of 61, now answer the following:
2324

2425
// b) What is the value assigned to num when pad is called for the first time?
25-
// =============> write your answer here
26+
// =============> the first time pad was called with the totalHours
2627

2728
// c) What is the return value of pad is called for the first time?
28-
// =============> write your answer here
29+
// =============> "00"
30+
2931

3032
// 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
33+
// =============> "1"
34+
// the last time, pad() is called with the remaining seconds which is value "1"
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"
38+
// When it is call for the last time it adds 0 before 1 to make it 2 characters long

0 commit comments

Comments
 (0)