Skip to content

Commit 8b22dfb

Browse files
committed
completed all questions in const remainingSeconds = seconds % 60
1 parent b4a4636 commit 8b22dfb

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

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

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

2323
// a) When formatTimeDisplay is called how many times will pad be called?
2424
// =============> write your answer here
25+
// pad will be called 3 times 1. pad(totalHours) 2.pad(remainingMinutes) 3. pad(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+
// num is 0
3032

3133
// c) What is the return value of pad is called for the first time?
3234
// =============> write your answer here
35+
// "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+
// num is 1, we are calling the pad with the argument remainingSeconds, when the formatTimeDisplay function was called
40+
// with the argument 61, the next line of code is a variable declaration and an expression, the resulting value from this
41+
// expression is passed into pad as an argument.
3642

3743
// e) What is the return value of pad when it is called for the last time in this program? Explain your answer
3844
// =============> write your answer here
45+
// num is 1 when passed as an argument into pad, the job of the function pad is to pad a zero before a number when said number is
46+
// less than 2 in length - so the return value will be "01"
47+

0 commit comments

Comments
 (0)