Skip to content

Commit b48ce39

Browse files
authored
Refine comments in 2-time-format.js for better understanding
Updated comments for clarity and added explanations for variable meanings.
1 parent 2e91aea commit b48ce39

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,22 @@ console.log(result);
1515

1616
// b) How many function calls are there?1
1717

18-
// c) Using documentation, explain what the expression movieLength % 60 represents
18+
// c) Using documentation, explain what the expression movieLength % 60 represents?
19+
//8784 % 60=24
1920
//The % operator is called the remainder operator.
2021
//It gives you the remainder left over after division.
22+
//we can calculate the number of the left seconds after converting the movie length into whole minutes, 24 seconds left over after converting the movie's total length into whole minutes.
2123
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators
2224

2325
// d) Interpret line 4, what does the expression assigned to totalMinutes mean?This removes the seconds that don't make up a complete minute.
26+
//Then it divides that number by 60 to convert the seconds into whole minutes.
27+
//we have 8784 seconds so
2428

25-
// e) What do you think the variable result represents? Can you think of a better name for this variable?creates a formatted representation of the movie's length in hours, minutes, and seconds.
29+
//8784 - 24 = 8760
30+
//8760 / 60 = 146 it is the total minutes
2631

32+
// e) What do you think the variable result represents? Can you think of a better name for this variable?creates a formatted representation of the movie's length in hours, minutes, and seconds.
33+
//I can name it the movie duration
2734
// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer
2835
//Works properly for non-negative whole-number seconds; decimals/negative values cause formatting problems
2936

0 commit comments

Comments
 (0)