Skip to content

Commit 78ff809

Browse files
committed
answered all the questions
1 parent 4de8d66 commit 78ff809

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed
Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const movieLength = 8784; // length of movie in seconds
1+
const movieLength = 348769045688; // length of movie in seconds
22

33
const remainingSeconds = movieLength % 60;
44
const totalMinutes = (movieLength - remainingSeconds) / 60;
@@ -11,15 +11,17 @@ console.log(result);
1111

1212
// For the piece of code above, read the code and then answer the following questions
1313

14-
// a) How many variable declarations are there in this program?
14+
// a) How many variable declarations are there in this program? there are 6 variable declarations
1515

16-
// b) How many function calls are there?
16+
// b) How many function calls are there? 1 function call (console.log).
1717

18-
// c) Using documentation, explain what the expression movieLength % 60 represents
18+
// c) Using documentation, explain what the expression movieLength % 60 represents it returns the remainder from dividing movieLength by 60.
1919
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators
2020

21-
// d) Interpret line 4, what does the expression assigned to totalMinutes mean?
21+
// d) Interpret line 4, what does the expression assigned to totalMinutes mean? it gives us the total whole minutes we have left after removing the remaining seconds from movieLength and dividing by 60.
2222

23-
// e) What do you think the variable result represents? Can you think of a better name for this variable?
23+
// e) What do you think the variable result represents? it represents the total time of the movie in hours, minutes and seconds.
24+
// Can you think of a better name for this variable? movieLengthFormat
2425

25-
// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer
26+
// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? I think it will work for all positive value of movieLength.
27+
// Explain your answer this is because the code is calculating the time format based on seconds, minutes and hours which are all positive values.

0 commit comments

Comments
 (0)