How do i get a var to multiply a number such as 0.01666 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do i get a var to multiply a number such as 0.01666

this is only part of the code to be implemented into my "Calculate Hours" code and the situation is this on the calculate hours code to properly account for time i had ro convert the minutes into a decimal by dividing the amount of minutes by 60 well this code is supposed to do the opposite by only multiplying the first 5 number after the decimal but but including "0." in front of it so if i put say 0.01666 it should come out as 1 but it comes out as a zero i tried it with a whole number and it worked and then 1.5 i only got 60 instead of 90 so i figured out it ignored everything past the decimal and my question is how do i get it to work with the numbers past the decimal point https://code.sololearn.com/WQzsrn02N4DP/?ref=app

17th Oct 2018, 8:14 AM
Brennan Woodroof
Brennan Woodroof - avatar
3 Answers
+ 2
Line 14: replace parseInt() with parseFloat()
17th Oct 2018, 8:21 AM
Anna
Anna - avatar
+ 1
Thanks Anna
17th Oct 2018, 8:30 AM
Brennan Woodroof
Brennan Woodroof - avatar
+ 1
You're welcome 😀
17th Oct 2018, 8:31 AM
Anna
Anna - avatar