Skip to content

Commit 33eb3b2

Browse files
authored
Add answers to all the questions.
1 parent fca8c46 commit 33eb3b2

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,26 @@ console.log(result);
1313

1414
// a) How many variable declarations are there in this program?
1515

16+
// There are six, all six lines of code use const as a variable declaration.
17+
1618
// b) How many function calls are there?
1719

20+
//There is only one funsction call, console.log(result)
21+
1822
// c) Using documentation, explain what the expression movieLength % 60 represents
1923
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators
2024

25+
// It represents how many seconds remain, before converting them to minutes first.
26+
2127
// d) Interpret line 4, what does the expression assigned to totalMinutes mean?
2228

29+
// it represents the movie length converted to minutes, without the remaining seconds.
30+
2331
// e) What do you think the variable result represents? Can you think of a better name for this variable?
2432

33+
//It represents the film length in a time string format. Better alternative could be formattedDuration, as it is self-explanatory,
34+
//as opposed to generic 'result'.
35+
2536
// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer
37+
38+
// I have tried values between 0-9, ie all positive/whole numbers, and it works. However there is no input validation, ie negative numbersm, non-integers etc, so it won't work properly there.

0 commit comments

Comments
 (0)