Wednesday, 27 May 2015

How to make parse float function in javascript return two decimal places

What happens when you use parseFloat() in javascript.
If you pass 10 to this parseFloat() then the output comes is just 10 not 10.00
So if you want to have output to two decimal places that is 10.00
use following


What it return is actually a string of format(##.##) when we use .toFixed(2)

No comments:

Post a Comment