@@ -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,22 @@ function formatTimeDisplay(seconds) {
1819
1920// a) When formatTimeDisplay is called how many times will pad be called?
2021// =============> write your answer here
22+ /* pad will be called 3 times. one for totalHours, one for remainingMinutes and one for remainingSeconds.*/
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?
2527// =============> write your answer here
28+ /* when I run the code the result is 00:01:01 there for the value assigned to num is "0".
2629
2730// c) What is the return value of pad is called for the first time?
2831// =============> write your answer here
32+ /* the return value is "00". this comes 0 changed to string and then padstart(2,0) changes it to "00" */
2933
3034// d) What is the value assigned to num when pad is called for the last time in this program? Explain your answer
3135// =============> write your answer here
36+ /* The value assigned to num when the pad is called for the last time is "1". */
3237
3338// e) What is the return value assigned to num when pad is called for the last time in this program? Explain your answer
3439// =============> write your answer here
40+ / * T h e r e t u r n v a l u e i s 1 . T h e c o d e 1 .t o S t r i n g ( ) c h a n g e s t h e n u m 1 t o s t r i n g " 1 " t h e n t h e c o d e .p a d S t a r t ( 2 , " 0 " ) ; c h a n g e s " 1 " t o " 0 1 "
0 commit comments