Skip to content

Commit 5fb3b93

Browse files
authored
Update comments with answers in time-format.js
Added explanations and answers to questions regarding the pad function in time-format.js.
1 parent 9dfa312 commit 5fb3b93

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

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

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

1919
// a) When formatTimeDisplay is called how many times will pad be called?
2020
// =============> write your answer here
21+
// =============> pad will be called 3 times
2122

2223
// Call formatTimeDisplay with an input of 61, now answer the following:
2324

2425
// b) What is the value assigned to num when pad is called for the first time?
25-
// =============> write your answer here
26+
// =============> the value assigned to num is 0
2627

2728
// c) What is the return value of pad is called for the first time?
28-
// =============> write your answer here
29+
// =============> the return value of pad is called for the first time is "00"
2930

3031
// d) What is the value assigned to num when pad is called for the last time in this program? Explain your answer
31-
// =============> write your answer here
32+
// =============> the value assigned to num is 1
33+
// because the last time pad is called for the remainingSeconds holding the value 1
34+
// return pad(remainingSeconds)
35+
// function pad(1){
3236

3337
// e) What is the return value assigned to num when pad is called for the last time in this program? Explain your answer
34-
// =============> write your answer here
38+
// =============> the return value of pad is called for the last time is "01"
39+
// because the argument passed to the pad parameter is the value of the remainingSeconds wich is 1
40+
// function pad(1){
41+
// return 1.toString().padStart(2, "0");
42+
// return "1".pad(2,"0");
43+
// return "01"
44+
//}

0 commit comments

Comments
 (0)