Javascript ToFixed Function Is Buggy

I used the toFixed() function in Javascript to round off decimal values to the nth place. However, when I compared the values converted in the Javascript and the values converted in PHP using its own round() function, they were not the same.

Seems like the round() function in Javascript does not give me the right value nor does the toFixed() as well. I did came across a post in the StackOverflow forum where member Jasper de Vries provided his own workaround combining both round() and toFixed().

That should fix the issue.

Related Posts Plugin for WordPress, Blogger...