Skip to content

Commit 36e4464

Browse files
committed
Implement pad function to track last num value
1 parent e642a44 commit 36e4464

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎Sprint-3/4-mandatory-interpret/time-format.js‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
// let padCalls = 0;
22
// let padCallCount = 0;
33
// let firstNum;
4+
let lastNum;
45

56
function pad(num) {
67
// padCalls++;
78
// padCallCount++;
89
// if (padCallCount === 1){
910
// firstNum = num;
1011
// }
12+
lastNum = num;
1113
let numString = num.toString();
1214
while (numString.length < 2) {
1315
numString = "0" + numString;
@@ -32,7 +34,7 @@ function formatTimeDisplay(seconds) {
3234
// console.log(`formatTimeDisplay(${s})==> ${result}| pad called ${padCalls} times `);
3335
// }
3436
formatTimeDisplay(61);
35-
console.log("The return value of pad when called for first time is:", firstReturn);
37+
console.log("The value assigned to num when pad is called for the last time is:", lastNum);
3638

3739
// You will need to play computer with this example - use the Python Visualiser https://pythontutor.com/visualize.html#mode=edit
3840
// to help you answer these questions

0 commit comments

Comments
 (0)