Skip to content

Commit 4f756c0

Browse files
committed
Implement function to track last pad return value
1 parent ad65ef3 commit 4f756c0

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
@@ -2,6 +2,7 @@
22
// let padCallCount = 0;
33
// let firstNum;
44
// let lastNum;
5+
let lastReturn;
56

67
function pad(num) {
78
// padCalls++;
@@ -17,6 +18,7 @@ function pad(num) {
1718
// if (padCallCount === 1){
1819
// firstReturn = numString;
1920
// }
21+
lastReturn = numString;
2022
return numString;
2123
}
2224

@@ -34,7 +36,7 @@ function formatTimeDisplay(seconds) {
3436
// console.log(`formatTimeDisplay(${s})==> ${result}| pad called ${padCalls} times `);
3537
// }
3638
formatTimeDisplay(61);
37-
console.log("The value assigned to num when pad is called for the last time is:", lastNum);
39+
console.log("The return value of pad when it is called for the last time is:", lastReturn);
3840

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

0 commit comments

Comments
 (0)