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
parseFloat(number).toFixed(2);
What it return is actually a string of format(##.##) when we use .toFixed(2)
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
parseFloat(number).toFixed(2);
What it return is actually a string of format(##.##) when we use .toFixed(2)
No comments:
Post a Comment