Skip to content

Commit 64a649f

Browse files
Answered following question in time format
1 parent 09bd32f commit 64a649f

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,31 @@ function formatTimeDisplay(seconds) {
1515
return `${pad(totalHours)}:${pad(remainingMinutes)}:${pad(remainingSeconds)}`;
1616
}
1717

18+
console.log(formatTimeDisplay(61));
19+
1820
// You will need to play computer with this example - use the Python Visualiser https://pythontutor.com/visualize.html#mode=edit
1921
// to help you answer these questions
2022

2123
// Questions
2224

2325
// a) When formatTimeDisplay is called how many times will pad be called?
2426
// =============> write your answer here
27+
// Answer : three times
2528

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+
// answer : 0
3034

3135
// c) What is the return value of pad is called for the first time?
3236
// =============> write your answer here
37+
// Answer : 00
3338

3439
// d) What is the value assigned to num when pad is called for the last time in this program? Explain your answer
3540
// =============> write your answer here
36-
41+
// answer : 1 and when pad is called, it is called remainingSecond as argument. when formatDisplay runs(61) then 61 divided by 60 and remaining number is 1,which passed to num, so the value of num is 1.
42+
//
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+
// answer: 01. return value is zero one because first received it one then pad formatted this number with two length.

0 commit comments

Comments
 (0)