Skip to content

Commit 3585299

Browse files
committed
time format
1 parent cf901b6 commit 3585299

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,11 @@ console.log(result);
2323
// e) What do you think the variable result represents? Can you think of a better name for this variable?
2424

2525
// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer
26+
27+
//There are 6 variables declared in this program: movieLength, remainingSeconds, totalMinutes, remainingMinutes, totalHours, and result.
28+
// There is 1 function calls in this program: console.log(), and the three arithmetic operations used to calculate remainingSeconds, totalMinutes, and remainingMinutes.
29+
// The expression movieLength % 60 calculates the remainder when movieLength is divided by 60. This gives the number of seconds remaining after converting the total length of the movie into minutes and hours.
30+
// Interpret line 4, the expression assigned to totalMinutes calculates the total number of minutes in the movie by subtracting the remaining seconds from the total length of the movie and dividing by 60.
31+
// The variable result represents the formatted string of the movie length in hours, minutes, and seconds. A better name for this variable could be formattedMovieLength or movieLengthString.
32+
// This code will work for all values of movieLength.
33+
// experimenting with different values of movieLength, such as 1:51:6, 0:55:33 etc., will show that the code correctly formats the length of the movie in hours, minutes, and seconds for all positive values.

0 commit comments

Comments
 (0)