Skip to content

Commit ad3fb4c

Browse files
committed
updated the code and changed the variable name
1 parent 7312985 commit ad3fb4c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ const totalHours = (totalMinutes - remainingMinutes) / 60;
88

99
const result = `${totalHours}:${remainingMinutes}:${remainingSeconds}`;
1010
console.log(result);
11-
11+
let movieDuration = `${totalHours}:${remainingMinutes}:${remainingSeconds}`;
12+
console.log(movieDuration);
1213
// For the piece of code above, read the code and then answer the following questions
1314

15+
1416
// a) How many variable declarations are there in this program?
1517
// there is 6 variable declarations
1618

@@ -26,6 +28,9 @@ console.log(result);
2628
//we are converting the seconds into minutes by dividing by 60
2729

2830
// e) What do you think the variable result represents? Can you think of a better name for this variable?
29-
//Duration of the movie in hours, minutes, and seconds.
31+
// we can change the name of the variable result into a clearer variable name like movieDuration
32+
//and if i want to change or update the value later i can use let instead of const
33+
// let movieDuration = `${totalHours}:${remainingMinutes}:${remainingSeconds}`;
34+
//the result will be the duration of the movie in hours, minutes, and seconds.
3035
// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer
3136
//yes it will work for all values of movieLength because the code will always convert seconds into hours, minutes, and seconds format.

0 commit comments

Comments
 (0)