You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Sprint-2/3-mandatory-interpret/2-time-format.js
+9-2Lines changed: 9 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -15,15 +15,22 @@ console.log(result);
15
15
16
16
// b) How many function calls are there?1
17
17
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
19
20
//The % operator is called the remainder operator.
20
21
//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.
// 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
24
28
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
26
31
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
27
34
// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer
28
35
//Works properly for non-negative whole-number seconds; decimals/negative values cause formatting problems
0 commit comments