Skip to content

Commit b195e6b

Browse files
committed
answered interpret 2
1 parent 65f0cda commit b195e6b

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

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+
// There are 6 variable declarations in this program.
1616
// b) How many function calls are there?
17-
17+
// There is 1 function call - console.log
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 % operator returns the remainder after one number is divided by another. In this expression, movieLength % 60 calculates the remaining seconds after converting the total movie length into whole minutes. Since there are 60 seconds in a minute, it gives the number of seconds left over.
2121
// d) Interpret line 4, what does the expression assigned to totalMinutes mean?
22-
22+
// The expression calculates the total number of complete minutes in the movie length by subtracting the remaining seconds and then dividing the remaining seconds by 60.
2323
// e) What do you think the variable result represents? Can you think of a better name for this variable?
24-
24+
// movieDuration would be a better variable name
2525
// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer
26+
// it works with a positive whole number but if your introduce decimal numbers or negative numbers the calculations will no longer work

0 commit comments

Comments
 (0)