Skip to content

Commit bbf3eaf

Browse files
fixed prettier time.js
1 parent 3e2cd2c commit bbf3eaf

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
function pad(num) {
2-
let numString = num.toString();
3-
while (numString.length < 2) {
4-
numString = "0" + numString;
5-
}
6-
return numString;
2+
let numString = num.toString();
3+
while (numString.length < 2) {
4+
numString = '0' + numString;
5+
}
6+
return numString;
77
}
88

99
function formatTimeDisplay(seconds) {
10-
const remainingSeconds = seconds % 60;
11-
const totalMinutes = (seconds - remainingSeconds) / 60;
12-
const remainingMinutes = totalMinutes % 60;
13-
const totalHours = (totalMinutes - remainingMinutes) / 60;
10+
const remainingSeconds = seconds % 60;
11+
const totalMinutes = (seconds - remainingSeconds) / 60;
12+
const remainingMinutes = totalMinutes % 60;
13+
const totalHours = (totalMinutes - remainingMinutes) / 60;
1414

15-
return `${pad(totalHours)}:${pad(remainingMinutes)}:${pad(remainingSeconds)}`;
15+
return `${pad(totalHours)}:${pad(remainingMinutes)}:${pad(remainingSeconds)}`;
1616
}
17-
console.log(formatTimeDisplay(61))
17+
console.log(formatTimeDisplay(61));
1818

1919
// You will need to play computer with this example - use the Python Visualiser https://pythontutor.com/visualize.html#mode=edit
2020
// to help you answer these questions
@@ -43,4 +43,4 @@ console.log(formatTimeDisplay(61))
4343
// e) What is the return value of pad when it is called for the last time in this program? Explain your answer
4444
// =============> write your answer here
4545
// The return value is "01" because the last call to pad is pad(1).
46-
// The pad function add a zero to make the number two digits.
46+
// The pad function add a zero to make the number two digits.

0 commit comments

Comments
 (0)