Skip to content

Commit f5499b3

Browse files
committed
add answers for the questions
1 parent 324b237 commit f5499b3

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,23 @@ 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+
// There are 6 variable declarations.
1516

1617
// b) How many function calls are there?
18+
// There is one function call.
1719

1820
// c) Using documentation, explain what the expression movieLength % 60 represents
1921
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators
22+
// The expression movieLength % 60 devides the movieLength by 60 seconds and return the reminder
23+
// which will be stroed in the const remainingSeconds.
2024

2125
// d) Interpret line 4, what does the expression assigned to totalMinutes mean?
26+
// Firstly, Removes the leftover seconds from movieLength and then converts the remaining seconds
27+
// into whole minutes which will be stored into totalMinutes.
2228

2329
// e) What do you think the variable result represents? Can you think of a better name for this variable?
30+
// The variable result reprents the movieLength in hours:minutes:seconds. The variable should be renamed by totalDuration.
2431

2532
// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer
33+
// I have tried with 3 variables, 1515, 9999 & 70052. I observed that this code works succesfully with all the values
34+
// and gave me results for all the different movieLength in hours:minutes:seconds.

0 commit comments

Comments
 (0)