File tree Expand file tree Collapse file tree
Sprint-2/3-mandatory-interpret Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- const movieLength = 8784 ; // length of movie in seconds
1+ const movieLength = 3000 ; // length of movie in seconds
22
33const remainingSeconds = movieLength % 60 ;
44const totalMinutes = ( movieLength - remainingSeconds ) / 60 ;
@@ -9,17 +9,21 @@ const totalHours = (totalMinutes - remainingMinutes) / 60;
99const result = `${ totalHours } :${ remainingMinutes } :${ remainingSeconds } ` ;
1010console . log ( result ) ;
1111
12- // For the piece of code above, read the code and then answer the following questions
1312
14- // a) How many variable declarations are there in this program?
1513
16- // b) How many function calls are there?
1714
18- // c) Using documentation, explain what the expression movieLength % 60 represents
19- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators
15+ //A.There are six variable declararions
2016
21- // d) Interpret line 4, what does the expression assigned to totalMinutes mean?
17+ //B. no function calls
2218
23- // e) What do you think the variable result represents? Can you think of a better name for this variable?
19+ // C.The % represents a remainder. The operator returns the remainder leftover when one operand which in
20+ // this cas is movieLength is divided by a second operand in this case 60%.
2421
22+
23+ // D.it means it is changing the value that was in second into minute by dividing it 60 after the top calculation makes it whole number.
24+
25+ //E. It represents the duration of the movie.movieLength/movieDuration.
26+
2527// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer
28+
29+ // yes it works, i experimented it with various values. I found it to be working properly.
You can’t perform that action at this time.
0 commit comments