File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Sprint-1/3-mandatory-interpret Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 1- const movieLength = 5464557657 ; // length of movie in seconds
1+ const movieLength = 1237401 ; // length of movie in seconds
22
33const remainingSeconds = movieLength % 60 ;
4+
45const totalMinutes = ( movieLength - remainingSeconds ) / 60 ;
56
67const remainingMinutes = totalMinutes % 60 ;
78const 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,
You can’t perform that action at this time.
0 commit comments