File tree Expand file tree Collapse file tree
Sprint-3/4-mandatory-interpret Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,18 +21,19 @@ function formatTimeDisplay(seconds) {
2121// Questions
2222
2323// a) When formatTimeDisplay is called how many times will pad be called?
24- // =============> write your answer here
24+ // =============> 3 times because the return statement has three pad() calls in it. Hrs, Mins, Secs.
2525
2626// Call formatTimeDisplay with an input of 61, now answer the following:
2727
2828// b) What is the value assigned to num when pad is called for the first time?
29- // =============> write your answer here
29+ // =============> The first pad call pad(totalHours) worked out to 0
3030
3131// c) What is the return value of pad when it is called for the first time?
32- // =============> write your answer here
32+ // =============> The value is 00, add another because every pad wants 2 digits.
3333
3434// 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
35+ // =============> the last pad call receives 1 as its num because last call called is pad(remainingSeconds) which is calculated as seconds % 60.
36+ // and with the seconds being 61, that's 61 % 60 giving 1
3637
3738// 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
39+ // =============> The call is pad(1) and the pad adds a 0 to make the string 2 digits
You can’t perform that action at this time.
0 commit comments