javascript. How to nicely format floating numbers to string without unnecessary decimal 0?
Here's an example input:
- 12.000
- 12.354
- 12.340
- 12.700
What I want is:
- 12
- 12.354
- 12.34
- 12.7
javascript. How to nicely format floating numbers to string without unnecessary decimal 0?
Here's an example input:
What I want is:
Use parseFloat
- it will take care of any floating 0
alert(parseFloat("12.00")); //12