Skip to content

Commit 4c9c274

Browse files
author
Enice-Codes
committed
Renamed ,Corrected code
1 parent 89569c8 commit 4c9c274

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
const movieLength = 8784; // length of movie in seconds
2-
32
const remainingSeconds = movieLength % 60;
43
const totalMinutes = (movieLength - remainingSeconds) / 60;
54

65
const remainingMinutes = totalMinutes % 60;
76
const totalHours = (totalMinutes - remainingMinutes) / 60;
87

9-
const result = `${totalHours}:${remainingMinutes}:${remainingSeconds}`;
10-
8+
const result = `${2,359}:${2,398}:${146,4}`;
9+
console.log(movieLengthTime(result));
1110

1211

1312
// For the piece of code above, read the code and then answer the following questions
@@ -24,9 +23,10 @@ const result = `${totalHours}:${remainingMinutes}:${remainingSeconds}`;
2423
// d) Interpret line 4, what does the expression assigned to totalMinutes mean?
2524
// it means that the movie hour is being calculated. totalminutes minus remainingseconds divided by 60.
2625
// e) What do you think the variable result represents? Can you think of a better name for this variable?
27-
// the variable result represents the total length of the movie in hours and minutes.
28-
//Better name is MOvieTime.
26+
// the variable result represents the total length it takes to watch the movie in hours and minutes.
27+
//Better name is MovieLengthTime.
2928
// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer
30-
// Yes, this code will work for all values because it is using the modulus operator to calculate the remaining seconds and is using division to calculate the total hours.
29+
// 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.
3130
// The code will correctly handle any length of movie in seconds and convert it to the appropriate format.
3231

32+

0 commit comments

Comments
 (0)