Skip to content

Commit 4aa639f

Browse files
committed
Time format pad()
1 parent 0a4c587 commit 4aa639f

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,27 @@ 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
2021

2122
// Questions
2223

2324
// a) When formatTimeDisplay is called how many times will pad be called?
24-
// =============> write your answer here
25+
// =============> The function pad() is called 3 times.
2526

2627
// Call formatTimeDisplay with an input of 61, now answer the following:
2728

2829
// b) What is the value assigned to num when pad is called for the first time?
29-
// =============> write your answer here
30+
// =============> When pad is called for the first time the value assigned to num is
31+
// totalHours
3032

3133
// c) What is the return value of pad is called for the first time?
32-
// =============> write your answer here
34+
// =============> The return value is 00
3335

3436
// d) What is the value assigned to num when pad is called for the last time in this program? Explain your answer
35-
// =============> write your answer here
37+
// =============> The value assigned to num when pad is being called for 3 time is remainingSeconds.
3638

3739
// e) What is the return value of pad when it is called for the last time in this program? Explain your answer
38-
// =============> write your answer here
40+
// =============> The return value of pad when called the last time is 01.

0 commit comments

Comments
 (0)