Skip to content

Commit 2478f22

Browse files
committed
answering the task questions
1 parent b6b4ffc commit 2478f22

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@ 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+
// six variable declarations: movieLength, remainingSeconds, totalMinutes, remainingMinutes, totalHours, result.
1616
// b) How many function calls are there?
17-
17+
// only one fuction call: console.log() in line 10.
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+
// the expression movieLength % 60 is using the modulus operator (%) to find the remainder when movieLength is divided by 60.
2121
// d) Interpret line 4, what does the expression assigned to totalMinutes mean?
22-
22+
// the expression assigned to totalMinutes is calculating the total number of minutes in the movie by subtracting the remaining seconds from the total movie length in seconds and then dividing the result by 60 to convert it to minutes.
2323
// e) What do you think the variable result represents? Can you think of a better name for this variable?
24-
24+
// the variable result represents the formatted string of the movie length in hours, minutes, and seconds. a better name for this variable could be formattedMovieLength or movieDurationFormatted.
2525
// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer
26+
// yes, this code will work for all values of movieLength as long as it is a non-negative integer representing the length of the movie in seconds. the code correctly calculates the hours, minutes, and seconds for any given length of time in seconds.

0 commit comments

Comments
 (0)