Skip to content

Commit c4470d9

Browse files
committed
time-format
1 parent f0201dd commit c4470d9

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

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

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

1515
return `${pad(totalHours)}:${pad(remainingMinutes)}:${pad(remainingSeconds)}`;
1616
}
17-
17+
console.log(formatTimeDisplay());
1818
// You will need to play computer with this example - use the Python Visualiser https://pythontutor.com/visualize.html#mode=edit
1919
// to help you answer these questions
2020

2121
// Questions
2222

2323
// a) When formatTimeDisplay is called how many times will pad be called?
2424
// =============> write your answer here
25-
25+
//- 3 times
2626
// Call formatTimeDisplay with an input of 61, now answer the following:
27-
28-
// b) What is the value assigned to num when pad is called for the first time?
29-
// =============> write your answer here
27+
// b) What is the value assigned to num when pad is called for the first time?
28+
//- 0
3029

3130
// c) What is the return value of pad when it is called for the first time?
3231
// =============> write your answer here
33-
32+
//- "00"
3433
// d) What is the value assigned to num when pad is called for the last time in this program? Explain your answer
3534
// =============> write your answer here
35+
//- 1, remainingSeconds is 1 because 61 % 60 = 1. The last call is pad(remainingSeconds) so pad(1) makes num = 1.
3636

3737
// e) What is the return value of pad when it is called for the last time in this program? Explain your answer
3838
// =============> write your answer here
39+
//- "01" , num.toString() changes 1 into "1". Since "1" has only 1 character, the while loop adds "0" in front, making "01".

0 commit comments

Comments
 (0)