Skip to content

Commit faeb0ff

Browse files
committed
all questions answered and code tested.
1 parent 0752aa5 commit faeb0ff

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,24 @@ function formatTimeDisplay(seconds) {
1818

1919
// a) When formatTimeDisplay is called how many times will pad be called?
2020
// =============> write your answer here
21+
// pad is called 3 times because there are 3 values to be padded - hours, minutes and seconds
2122

2223
// Call formatTimeDisplay with an input of 61, now answer the following:
24+
console.log(formatTimeDisplay(61)); // Should return "00:01:01"
2325

2426
// b) What is the value assigned to num when pad is called for the first time?
2527
// =============> write your answer here
28+
// num is assigned the value of totalHours which is 0 because 61 seconds is less than a minute
2629

2730
// c) What is the return value of pad is called for the first time?
2831
// =============> write your answer here
32+
// The return value is "00" because the padStart method adds a "0" to the start of the string "0" to make it 2 characters long
2933

3034
// d) What is the value assigned to num when pad is called for the last time in this program? Explain your answer
3135
// =============> write your answer here
36+
// num is assigned the value of remainingSeconds which is 1 because 61 seconds is 1 second more than a full minute (60 seconds)
3237

3338
// e) What is the return value assigned to num when pad is called for the last time in this program? Explain your answer
3439
// =============> write your answer here
40+
// The return value is "01" because the padStart method adds a "0" to the start of the string "1" to make it 2 characters long
41+

0 commit comments

Comments
 (0)