Skip to content

Commit 386badc

Browse files
committed
evaluated program in time-format,js file
1 parent 8de2fab commit 386badc

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ function formatTimeDisplay(seconds) {
1010

1111
return `${pad(totalHours)}:${pad(remainingMinutes)}:${pad(remainingSeconds)}`;
1212
}
13+
console.log(formatTimeDisplay(61));
1314

1415
// You will need to play computer with this example - use the Python Visualiser https://pythontutor.com/visualize.html#mode=edit
1516
// to help you answer these questions
@@ -18,17 +19,21 @@ function formatTimeDisplay(seconds) {
1819

1920
// a) When formatTimeDisplay is called how many times will pad be called?
2021
// =============> write your answer here
22+
// pad() is called 3 Times whenever formatTimeDisplay() is called.
2123

2224
// Call formatTimeDisplay with an input of 61, now answer the following:
23-
2425
// b) What is the value assigned to num when pad is called for the first time?
2526
// =============> write your answer here
27+
// The first call to pad() is 0, for totalHours which is 0
2628

2729
// c) What is the return value of pad is called for the first time?
2830
// =============> write your answer here
31+
// The return value is 00
2932

3033
// d) What is the value assigned to num when pad is called for the last time in this program? Explain your answer
3134
// =============> write your answer here
35+
// 1: -> pad() was called from line 11. Given that num is 0, the first call to pad() (for totalHours which is 0). There were two more calls to pad()(for remainingLastMinutes and remaining LastSeconds) and the value assigned to num for the last call is 0
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
3438
// =============> write your answer here
39+
//01 -> Given that num is 1, the last call to pad() (for remainingSeconds is 1) and the return value is 01,

0 commit comments

Comments
 (0)