Skip to content

Commit 5e6eda5

Browse files
committed
added maths.abs to handle any negative values
1 parent 889b216 commit 5e6eda5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const movieLength = -348769045688; // length of movie in seconds
22

3-
const remainingSeconds = movieLength % 60;
4-
const totalMinutes = (movieLength - remainingSeconds) / 60;
3+
const remainingSeconds = Math.abs(movieLength) % 60;
4+
const totalMinutes = (Math.abs(movieLength) - remainingSeconds) / 60;
55

66
const remainingMinutes = totalMinutes % 60;
77
const totalHours = (totalMinutes - remainingMinutes) / 60;

0 commit comments

Comments
 (0)