Skip to content

Commit 8d19a7a

Browse files
I gives the answer for f and change after your reviews. for different values of movieLength.
1 parent 9b67e32 commit 8d19a7a

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

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

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
const movieLength = 8784;
1+
// const movieLength = 8784;
2+
// const movieLength = -1;
3+
// const movieLength = 8784.5;
4+
// const movieLength = 'abc';
5+
const movieLength = 3605;
26
const remainingSeconds = movieLength % 60;
37
const totalMinutes = (movieLength - remainingSeconds) / 60;
48

@@ -30,10 +34,9 @@ console.log(result);
3034
We can change this name as movieTime*/
3135

3236
// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer
33-
/* In this section we can only use the positive natural numbers but if we put numbers that divide by 60 without a remainder get the exact time like 10, 20 50 */
34-
/*"Percent (%) is a way to describe the full amount of anything by imagining it split into 100 equal sections.*/
35-
/*we take out the odd seconds before converting to minutes so that when we divide by 60 we can get the exact whole number instead of messy decimal so that*/
36-
/* i try both decimal both terminal is not showing the error type looks prefect */
37-
/*[Running] node "c:\Users\Asus\Desktop\code your future\Module-Onboarding\Module-JavaScript-Fundamentals\Sprint-2\Sprint-2\3-mandatory-interpret\2-time-format.js"
38-
2:26:24
39-
/* In this case 60% is the remaining second after take out all minutes there has remain second is 24 */
37+
/* No, it's does not work for all values. It works correctly for any non-negative whole number of seconds.
38+
1. Negative Number: -1 gives the answer 0:0:-1 which is not the valid time because -1 is not the time formate.
39+
due to the divide the dividend keeps the negatives seconds.
40+
2. Decimals: Move length: 8784.5 gives the answer 2:26:24.5. So, seconds are not a whole numbers in real world.
41+
3. Not a numbers: move length: 'abc'.. When we put the not numbers then they gives the NaN:NaN:NaN(Not a Number) answer.
42+
4. also when we divide the numbers like 3605 its shows the answer */

0 commit comments

Comments
 (0)