Skip to content

Commit f33a665

Browse files
committed
Calculate movie length in Hours:Minutes:Seconds
1 parent 8cc6b17 commit f33a665

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,17 @@ console.log(result);
1212
// For the piece of code above, read the code and then answer the following questions
1313

1414
// a) How many variable declarations are there in this program?
15-
15+
// 6
1616
// b) How many function calls are there?
17-
17+
// 1
1818
// c) Using documentation, explain what the expression movieLength % 60 represents
1919
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators
20-
20+
// Remainder operator : calculates the remainder after dividing the movie length in seconds by 60
2121
// d) Interpret line 4, what does the expression assigned to totalMinutes mean?
22+
// It takes the remaining seconds away from the total movie length and divides by 60 to turn the seconds into minutes.
2223

2324
// e) What do you think the variable result represents? Can you think of a better name for this variable?
24-
25+
// - It represents the movie duration in hours, minutes, and seconds.
26+
// - const movieDuration
2527
// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer
28+
// The code works with positive whole numbers for movieLength and changes them into hours, minutes, and seconds. Decimal or negative numbers may not give the correct result.

0 commit comments

Comments
 (0)