If you have these numbers:
2
2.05
2.547
2.5
How can I do a check to see if the number has two decimal places?
If it has 2 decimals, how do you drop the second decimal number (rounding) but keep the trailing 0 if needed?
Examples of results:
2.05 would end in 2.1
2.04 would end in 2.0
2.54 would end in 2.5
I realise you can use toFixed(1), but that converts it to a string. And if you convert it to a int with parseInt(), it loses the trailing zero
Thanks guys