Skip to content

Commit fb5a7e3

Browse files
committed
Answer questions in time-format.js
1 parent 5acd69c commit fb5a7e3

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,20 @@ 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+
// Answer: 3 times
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+
// Answer: 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+
// Answer: "00"
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+
// Answer: 1. Num is 1 in the last call to pad, because the argument sent into pad is remainingSeconds, which is
36+
// 1 because 1 is the remainder after dividing 61 with 60.
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+
// Answer: "01". The return value is "01" because pad first turned 1 into a string "1", and then used a while loop
40+
// to concatenate (pad) zeros at the start of the "1" string until it became two in length.

0 commit comments

Comments
 (0)