Skip to content

Commit 00822ed

Browse files
committed
Clarify pad function usage and expected outputs
1 parent 57e7509 commit 00822ed

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

‎Sprint-3/4-mandatory-interpret/time-format.js‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,31 @@ function formatTimeDisplay(seconds) {
2323
// a) When formatTimeDisplay is called how many times will pad be called?
2424
// =============> write your answer here
2525

26+
//formatTimeDisplay will call pad three times, once for totalHours, once for
27+
// remainingMinutes, and once for remainingSeconds.
28+
2629
// Call formatTimeDisplay with an input of 61, now answer the following:
2730

2831
// b) What is the value assigned to num when pad is called for the first time?
2932
// =============> write your answer here
33+
// The value assigned to num when pad is called for the first time is 0, which is the value
34+
// of totalHours when the input is 61 seconds.
3035

3136
// c) What is the return value of pad when it is called for the first time?
3237
// =============> write your answer here
3338

39+
// The return value of pad when it is called for the first time is "00", which is the string
40+
// representation of totalHours padded with a leading zero.
41+
3442
// d) What is the value assigned to num when pad is called for the last time in this program? Explain your answer
3543
// =============> write your answer here
44+
// The value assigned to num when pad is called for the last time in this program is 1,
45+
// which is the value of remainingSeconds when the input is 61 seconds. This is because 61
46+
// seconds has 1 second remaining after calculating the total minutes and hours.
3647

3748
// e) What is the return value of pad when it is called for the last time in this program? Explain your answer
3849
// =============> write your answer here
50+
// The return value of pad when it is called for the last time in this program is "01",
51+
// which is the string representation of remainingSeconds padded with a leading zero.
52+
// This is because the value of remainingSeconds is 1, and the pad function adds a leading
53+
// zero to make it a two-digit string.

0 commit comments

Comments
 (0)