Skip to content

Commit 71baeb7

Browse files
answer all the question
1 parent a52cfdb commit 71baeb7

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const movieLength = 8784; // length of movie in seconds
1+
const movieLength = 5467; // length of movie in seconds
22

33
const remainingSeconds = movieLength % 60;
44
const totalMinutes = (movieLength - remainingSeconds) / 60;
@@ -12,14 +12,25 @@ 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 declaration in this program.
16+
1- movieLength , 2- remainingSeconds , 3- totalMinutes
17+
4- remainingMinutes , 5- totalHours , 6- result */
1518

1619
// b) How many function calls are there?
20+
/* one function
21+
Line 10 : console.log(); */
1722

1823
// c) Using documentation, explain what the expression movieLength % 60 represents
1924
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators
25+
// Remainder(%) : Return the remainder left over when one operand is divided by a second operand
26+
// console.log(13 % 5 ); 3
2027

2128
// d) Interpret line 4, what does the expression assigned to totalMinutes mean?
29+
// This expression converts movie length from seconds into minutes
2230

2331
// e) What do you think the variable result represents? Can you think of a better name for this variable?
32+
// Variable result represent the movie length formatted as hours, minutes, seconds ,
33+
// another name could be movieTime
2434

2535
// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer
36+
// This code works for normal positive number representing but for negative number and very big number it is not working

0 commit comments

Comments
 (0)