@@ -25,24 +25,24 @@ console.log(formatTimeDisplay(61));
2525
2626// b) What is the value assigned to num when pad is called for the first time?
2727// =============> The first call to pad is pad(totalHours).
28- totalHours is calculated as totalMinutes // 60.
29- For the input 61 , seconds is 61 , remainingSeconds is 1 , and totalMinutes is 1.
30- So , totalHours is 1 // 60 = 0.
31- Therefore , num is assigned the value 0 when pad is called for the first time .
28+ // totalHours is calculated as totalMinutes // 60.
29+ // For the input 61, seconds is 61, remainingSeconds is 1, and totalMinutes is 1.
30+ // So, totalHours is 1 // 60 = 0.
31+ // Therefore, num is assigned the value 0 when pad is called for the first time.
3232
3333
3434// c) What is the return value of pad is called for the first time?
3535// =============> The first call to pad is pad(totalHours).
36- totalHours is calculated as totalMinutes // 60.
37- For the input 61 , totalMinutes is ( 61 - 1 ) // 60 = 1.
38- So , totalHours is 1 // 60 = 0.
39- pad ( 0 ) returns the string representation of 0 , padded with zeros to a minimum length of 2 , which is "00" .
36+ // totalHours is calculated as totalMinutes // 60.
37+ // For the input 61, totalMinutes is (61 - 1) // 60 = 1.
38+ // So, totalHours is 1 // 60 = 0.
39+ // pad(0) returns the string representation of 0, padded with zeros to a minimum length of 2, which is "00".
4040
4141// d) What is the value assigned to num when pad is called for the last time in this program? Explain your answer
4242// =============> We look at the last call to pad, which is pad(remaining_seconds).
43- remaining_seconds is calculated as seconds % 60.
44- For the input 61 , seconds % 60 equals 1.
45- So , pad ( remaining_seconds ) is equivalent to pad ( 1 ) . The value assigned to num in the last call to pad is 1.
43+ // remaining_seconds is calculated as seconds % 60.
44+ // For the input 61, seconds % 60 equals 1.
45+ // So, pad(remaining_seconds) is equivalent to pad(1). The value assigned to num in the last call to pad is 1.
4646
4747// e) What is the return value assigned to num when pad is called for the last time in this program? Explain your answer
48- // =============> For the input 61, remaining_seconds will be 1. So, pad(1) will return "01". Therefore, the value assigned to num is 1.
48+ // For the input 61, remaining_seconds will be 1. So, pad(1) will return "01". Therefore, the value assigned to num is 1.
0 commit comments