File tree Expand file tree Collapse file tree
Sprint-2/3-mandatory-interpret Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- const movieLength = 8788 ; // length of movie in seconds
1+ const movieLength = 59 ; // length of movie in seconds
22
33const remainingSeconds = movieLength % 60 ;
44const 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.
You can’t perform that action at this time.
0 commit comments