Skip to content

Commit 7277b60

Browse files
committed
Answered questions, rem calculations
1 parent a680b43 commit 7277b60

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ function pad(num) {
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; // 1
11+
const totalMinutes = (seconds - remainingSeconds) / 60; // 1
12+
const remainingMinutes = totalMinutes % 60; // 1
13+
const totalHours = (totalMinutes - remainingMinutes) / 60; //0
1414

1515
return `${pad(totalHours)}:${pad(remainingMinutes)}:${pad(remainingSeconds)}`;
1616
}
@@ -21,18 +21,18 @@ function formatTimeDisplay(seconds) {
2121
// Questions
2222

2323
// a) When formatTimeDisplay is called how many times will pad be called?
24-
// =============> write your answer here
24+
// 3 times
2525

2626
// Call formatTimeDisplay with an input of 61, now answer the following:
27-
27+
console.log(formatTimeDisplay(61)) // 00:01:01
2828
// b) What is the value assigned to num when pad is called for the first time?
29-
// =============> write your answer here
29+
// 0
3030

3131
// c) What is the return value of pad when it is called for the first time?
32-
// =============> write your answer here
32+
// "00"
3333

3434
// d) What is the value assigned to num when pad is called for the last time in this program? Explain your answer
35-
// =============> write your answer here
35+
// 1
3636

3737
// e) What is the return value of pad when it is called for the last time in this program? Explain your answer
38-
// =============> write your answer here
38+
// "01"

0 commit comments

Comments
 (0)