Wednesday, July 25, 2012

Javascript – Format number to always show the original decimal places



I need a js function that show the original count of decimals in a number. For example:



value display
2.31 2
1.0 1
2.3500 4


The problem is that i dont know how get the count of decimals.

I have that code:

value=2.3500;

return CountofDecimals(value); // must be display 4:


Anything help??? Thanks :P






Rating: 4 out of 5 based on 4 ratings



The post Javascript – Format number to always show the original decimal places appeared first on Javascript ASK.






via Javascript ASK http://javascriptask.phpfogapp.com/javascript-format-number-to-always-show-the-original-decimal-places.html

No comments:

Post a Comment