@@ -15,24 +15,26 @@ function formatTimeDisplay(seconds) {
1515 return `${ pad ( totalHours ) } :${ pad ( remainingMinutes ) } :${ pad ( remainingSeconds ) } ` ;
1616}
1717
18+ console . log ( formatTimeDisplay ( 61 ) ) ;
19+
1820// You will need to play computer with this example - use the Python Visualiser https://pythontutor.com/visualize.html#mode=edit
1921// to help you answer these questions
2022
2123// Questions
2224
2325// a) When formatTimeDisplay is called how many times will pad be called?
24- // =============> write your answer here
26+ // Answer: Three times, once for hours, once for minutes, and once for seconds.
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?
29- // =============> write your answer here
31+ // Answer: 0, because 61 seconds contains 0 whole hours.
3032
3133// c) What is the return value of pad when it is called for the first time?
32- // =============> write your answer here
34+ // Answer: "00". pad converts 0 to a string and prepends a zero.
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+ // Answer: 1, because the remaining seconds after 61 is divided into minutes is 1.
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+ // Answer: "01", because pad converts 1 to a string and prepends a zero.
0 commit comments