Skip to content

Commit 0ea7adf

Browse files
committed
add mandatory interpret time format
1 parent df8a9ad commit 0ea7adf

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,22 @@ function formatTimeDisplay(seconds) {
2222

2323
// a) When formatTimeDisplay is called how many times will pad be called?
2424
// =============> write your answer here
25+
// It will be called 3 times, once for each of totalHours, remainingMinutes, and remainingSeconds.
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?
2930
// =============> write your answer here
31+
// The value assigned to num when pad is called for the first time is 0, which is the value of totalHours when seconds is 61.
3032

3133
// c) What is the return value of pad is called for the first time?
3234
// =============> write your answer here
35+
// The return value of pad when it is called for the first time is "00". Since num is 0, the while loop adds a "0" to the front of numString until its length is 2, resulting in "00".
3336

3437
// d) What is the value assigned to num when pad is called for the last time in this program? Explain your answer
3538
// =============> write your answer here
39+
// The value assigned to num when pad is called for the last time in this program is 1, which is the value of remainingSeconds when seconds is 61. This is because 61 seconds is equal to 1 minute and 1 second, so remainingSeconds is calculated as 61 % 60, which equals 1.
3640

3741
// e) What is the return value of pad when it is called for the last time in this program? Explain your answer
3842
// =============> write your answer here
43+
// The return value of pad when it is called for the last time in this program is "01". Since num is 1, the while loop adds a "0" to the front of numString until its length is 2, resulting in "01".

0 commit comments

Comments
 (0)