@@ -10,7 +10,7 @@ const result = `${totalHours}:${remainingMinutes}:${remainingSeconds}`;
1010console . log ( result ) ;
1111
1212// testing different cases
13- function movieLengthToDuration ( movieLength ) {
13+ function movieLengthFormatter ( movieLength ) {
1414 const remainingSeconds = movieLength % 60 ;
1515 const totalMinutes = ( movieLength - remainingSeconds ) / 60 ;
1616
@@ -21,18 +21,18 @@ function movieLengthToDuration(movieLength) {
2121 return result ;
2222}
2323
24- console . log ( movieLengthToDuration ( 0 ) ) ;
25- console . log ( movieLengthToDuration ( 59 ) ) ;
26- console . log ( movieLengthToDuration ( 10000 ) ) ;
27- console . log ( movieLengthToDuration ( - 100 ) ) ;
28- console . log ( movieLengthToDuration ( 200.4 ) ) ;
24+ console . log ( movieLengthFormatter ( 0 ) ) ;
25+ console . log ( movieLengthFormatter ( 59 ) ) ;
26+ console . log ( movieLengthFormatter ( 10000 ) ) ;
27+ console . log ( movieLengthFormatter ( - 100 ) ) ;
28+ console . log ( movieLengthFormatter ( 200.4 ) ) ;
2929// For the piece of code above, read the code and then answer the following questions
3030
3131// a) How many variable declarations are there in this program?
3232// There are 6 variable declarations.
3333
3434// b) How many function calls are there?
35- // There are no function calls .
35+ // There is `console.log` as a function call .
3636
3737// c) Using documentation, explain what the expression movieLength % 60 represents
3838// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators
@@ -45,7 +45,7 @@ console.log(movieLengthToDuration(200.4));
4545
4646// e) What do you think the variable result represents? Can you think of a better name for this variable?
4747// The variable result represents the final result of the movie duration in the format of H:M:S.
48- // The better name fort this variable could be movieDuration .
48+ // The better name for this variable could be movieLengthFormatted .
4949
5050// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer
5151// There are a couple of edge cases that this code will not work for:
0 commit comments