Skip to content

Commit 02966a9

Browse files
complete movie time interpretation
1 parent c7309cf commit 02966a9

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const movieLength = 8788; // length of movie in seconds
1+
const movieLength = 59; // length of movie in seconds
22

33
const remainingSeconds = movieLength % 60;
44
const totalMinutes = (movieLength - remainingSeconds) / 60;
@@ -24,13 +24,14 @@ console.log(result);
2424
// movieLength % 60 finds the remaining seconds after dividing the movie length by 60.
2525

2626
// d) Interpret line 4, what does the expression assigned to totalMinutes mean?
27-
// d) totalMinutes is assigned the value 146 after subtracting the remaining seconds
27+
// d) totalMinutes is assigned the value 0 after subtracting the remaining seconds
2828
// from movieLength and dividing the result by 60
2929

3030
// e) What do you think the variable result represents? Can you think of a better name for this variable?
3131
// e) It creates the movie's time format
3232
// Maybe a more descriptive movieTime or movieDuration
3333

3434
// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer
35-
// f) The code works for different whole-number values of movieLength
36-
// the result changes depending on the movie's length
35+
// f) The code does not work correctly for all values of movieLength
36+
// It works correctly for non-negative whole numbers, but negative numbers and
37+
// decimal values can produce an invalid time format.

0 commit comments

Comments
 (0)