@@ -12,14 +12,37 @@ 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+ // *Answer
16+ // There are 6.
1517
1618// b) How many function calls are there?
19+ // *Answer
20+ // There is 1; console.log()
1721
1822// c) Using documentation, explain what the expression movieLength % 60 represents
23+ //*Answer
24+ // This expression returns the remainder of seconds, after dividing the movieLength by 60,
25+ // using the modulus operator it returns 24 seconds
1926// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators
2027
21- // d) Interpret line 4, what does the expression assigned to totalMinutes mean?
22-
23- // e) What do you think the variable result represents? Can you think of a better name for this variable?
2428
25- // f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer
29+ // d) Interpret line 4, what does the expression assigned to totalMinutes mean?
30+ // *Answer
31+ // It is converting the seconds to minutes and rounding it to the last whole minute.
32+
33+ // e) What do you think the variable result represents?
34+ //*Answer
35+ // The result is the duration of the film in hours, minutes and seconds - 2:26:24.
36+
37+ // Can you think of a better name for this variable?
38+ // *Answer
39+ // movieDuration
40+
41+ // f) Try experimenting with different values of movieLength.
42+ // Will this code work for all values of movieLength? Explain your answer,
43+ // *Answer
44+ // I changed the value to;
45+ // 1200 returned 0:20:00
46+ // 92383.7 returned 25:39:43.69999999999709
47+ // -8784 returned -2:-26:-24
48+ // it worked with all numbers including decimals and negative numbers.
0 commit comments