Skip to content

Commit ab656e8

Browse files
fix: update movieLength value and rename result variable for clarity
1 parent f091869 commit ab656e8

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
1-
const movieLength = 5464557657; // length of movie in seconds
1+
const movieLength = 1237401; // length of movie in seconds
22

33
const remainingSeconds = movieLength % 60;
4+
45
const totalMinutes = (movieLength - remainingSeconds) / 60;
56

67
const remainingMinutes = totalMinutes % 60;
78
const totalHours = (totalMinutes - remainingMinutes) / 60;
89

9-
const result = `${totalHours}:${remainingMinutes}:${remainingSeconds}`;
10-
console.log(result);
10+
const timeInHhMmSs = `${totalHours
11+
.toString()
12+
.padStart(2, "0")}:${remainingMinutes
13+
.toString()
14+
.padStart(2, "0")}:${remainingSeconds.toString().padStart(2, "0")}`;
15+
console.log(timeInHhMmSs);
1116

1217
// For the piece of code above, read the code and then answer the following questions
1318

@@ -25,7 +30,7 @@ console.log(result);
2530
//total time in minutes without the remaining seconds
2631

2732
// e) What do you think the variable result represents? Can you think of a better name for this variable?
28-
//it represents the total movie time , so.... const totalMovieTime perhaps
33+
//it represents the total movie time , so.... const timeInHhMmSs perhaps
2934

3035
// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer
3136
//it will work with all values as long as they are numbers,

0 commit comments

Comments
 (0)