Skip to content

Commit 8a8a3f7

Browse files
author
Enice-Codes
committed
modified some answers
1 parent 4c9c274 commit 8a8a3f7

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Sprint-1/3-mandatory-interpret/2-time-format.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
const movieLength = 8784; // length of movie in seconds
1+
const movieLength = 3609; // length of movie in seconds
22
const remainingSeconds = movieLength % 60;
33
const totalMinutes = (movieLength - remainingSeconds) / 60;
44

55
const remainingMinutes = totalMinutes % 60;
66
const totalHours = (totalMinutes - remainingMinutes) / 60;
77

8-
const result = `${2,359}:${2,398}:${146,4}`;
9-
console.log(movieLengthTime(result));
8+
const formattedMovieTime = `${totalHours}:${String(remainingMinutes).padStart(2, "0")}:${String(remainingSeconds).padStart(2, "0")}`;
9+
console.log(formattedMovieTime);
1010

1111

1212
// For the piece of code above, read the code and then answer the following questions
@@ -24,7 +24,7 @@ console.log(movieLengthTime(result));
2424
// it means that the movie hour is being calculated. totalminutes minus remainingseconds divided by 60.
2525
// e) What do you think the variable result represents? Can you think of a better name for this variable?
2626
// the variable result represents the total length it takes to watch the movie in hours and minutes.
27-
//Better name is MovieLengthTime.
27+
//Better name is formattedMovieTime.
2828
// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer
2929
// Yes, this code will work for different values of movieLength because it calculates the total hours, minutes and seconds based on the length of the movie in seconds.
3030
// The code will correctly handle any length of movie in seconds and convert it to the appropriate format.

0 commit comments

Comments
 (0)