Skip to content

Commit e0d3cbf

Browse files
committed
the time-format.js is done
1 parent f77a875 commit e0d3cbf

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

Sprint-2/1-key-errors/0.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ function capitalise(str) {
1717
return `${str[0].toUpperCase()}${str.slice(1)}`;
1818

1919
}
20-
console.log(capitalise("hello world"));
20+
console.log(capitalise("hello world"));

Sprint-2/4-mandatory-interpret/time-format.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,32 @@ function formatTimeDisplay(seconds) {
1111
return `${pad(totalHours)}:${pad(remainingMinutes)}:${pad(remainingSeconds)}`;
1212
}
1313

14+
15+
console.log(formatTimeDisplay(61 ));
16+
1417
// You will need to play computer with this example - use the Python Visualiser https://pythontutor.com/visualize.html#mode=edit
1518
// to help you answer these questions
1619

1720
// Questions
1821

1922
// a) When formatTimeDisplay is called how many times will pad be called?
2023
// =============> write your answer here
24+
// it will be called 3 times, because in the return statement we called it 3 times, once for hours, once for minutes and once for seconds.
2125

2226
// Call formatTimeDisplay with an input of 61, now answer the following:
2327

2428
// b) What is the value assigned to num when pad is called for the first time?
2529
// =============> write your answer here
30+
// the value assigned to num is totalHours which is 0.
2631

2732
// c) What is the return value of pad is called for the first time?
2833
// =============> write your answer here
29-
34+
// it is 00
3035
// d) What is the value assigned to num when pad is called for the last time in this program? Explain your answer
3136
// =============> write your answer here
37+
//The value assigned to num when pad is called for the last time is 1, because remainingSeconds = 1
3238

3339
// e) What is the return value assigned to num when pad is called for the last time in this program? Explain your answer
3440
// =============> write your answer here
41+
//The return value of pad(1) is "01".
42+
//That’s because inside pad, the number 1 becomes the string "1", and then padStart(2, "0") adds a leading zero to make it two digits.

Sprint-2/Prep/elevator.js

Whitespace-only changes.

0 commit comments

Comments
 (0)