Is there any better way other than
Math.round(0.2+0.4) = 0.6
Actually, I have a series of index 0, 0.02, 0.04, 0.06, 0.08, 0.10 ----
I have to convert it to Array Index 0,1,2,3,4,5-- by dividing by 0.02
JavaScript provides
0.28/0.02 = 14.000000000000002
I solve this problem by Math.round(0.28/0.02).
I am curious is there any other or better way to solve this problem
No comments:
Post a Comment