File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
Sprint-2/4-mandatory-interpret Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -11,24 +11,26 @@ function formatTimeDisplay(seconds) {
1111 return `${ pad ( totalHours ) } :${ pad ( remainingMinutes ) } :${ pad ( remainingSeconds ) } ` ;
1212}
1313
14+ console . log ( formatTimeDisplay ( 61 ) ) ;
15+
1416// You will need to play computer with this example - use the Python Visualiser https://pythontutor.com/visualize.html#mode=edit
1517// to help you answer these questions
1618
1719// Questions
1820
1921// a) When formatTimeDisplay is called how many times will pad be called?
20- // =============> write your answer here
22+ // =============> write your answer here it will be called 3 times
2123
2224// Call formatTimeDisplay with an input of 61, now answer the following:
2325
2426// b) What is the value assigned to num when pad is called for the first time?
25- // =============> write your answer here
27+ // =============> write your answer here num = 0 on the first call
2628
2729// c) What is the return value of pad is called for the first time?
28- // =============> write your answer here
30+ // =============> write your answer here return value = "00"
2931
3032// 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
33+ // =============> write your answer here num = 1 when called for the last time because remainingSeconds has a value of 1 from 61%60 = 1
3234
3335// 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
36+ // =============> write your answer here return value will be "01" since num has 1 digit pad adds a 0 to the start to make it 2 digits.
You can’t perform that action at this time.
0 commit comments